10 May’19

Dynamics 365Add Dynamics 365 Lookup functionality in HTML Web resource

Introduction

In this blog we will look at how we can add the lookup functionality of dynamics 365 Customer Engagement in our HTML web resource.

Implementation

Step 1 : We have already added a web resource in our app, you can refer to my blog on  “ADD HTML page in Dynamics 365 Customer Engagement Apps”. Below is the screenshot of how it looks like

WebResource InApp

Step 2: Here we have a project field, and every time the Project button is clicked the select Project form opens up as shown in the below image. Please note that the Project entity we are using is a custom entity and not the Out of Box project entity

Select Project Lookup

Step 3 : When the Project is selected from this and the Add option is clicked, the name of the project will be shown in the “Select Project” field on the HTML web resource.

Project is Selected

SelectedProject is shown in the label

Step 4: The HTML code for this is here. 

In the HTML code there is a reference to an external JavaScript file which handles the logic to open the lookup tab and set the name of selected project as seen previously.
You can find the JavaScript code here

Note:

  1. In the referenced HTML code, for the Layout button we have added an “on Click” event which is not present in the referenced JavaScript code.  So while using the referenced code, please make sure you remove that reference from the HTML or add another function that you would like to call.

Below shown in the code snippet that needs to be modified

 <input class="form-control" id="selectedProjectRelatedLayout" type="text" placeholder="Select Layout" readonly="">

2.  In HTML file we have also added the reference to a JavaScript file which we have added as a JavaScript web resource in Dynamics 365 CE.  You will need to modify this reference  based on the web resource structure in Dynamics 365 CE.

<!-- Below mentioned are the CRM Reference files based on the hierarchy of Webresources created, the bottom two references will change according to your folder structure for Webresources in CRM-->
<script src="../../../../ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script src="../BusinessLayer/SafetyInspectionCustomization.js" type="text/javascript"></script>

Hope this helped!

Written by

Clinton D'Mello

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Expenses in PSA for Fixed Bid and T&M contracts

    23 August’ 2019

    Problem Definition: One of my clients decided to use Expense module in PSA and to his surprise he could see the amount v...

    Read more
  • Setup Dockers

    23 August’ 2019

    Docker is an independent container platform that enables organizations to seamlessly build, share and run any applicatio...

    Read more
  • Qualify Lead in D365 CE: Select which entity records should be created

    20 August’ 2019

    Wave 2019 Updates brought some really sought-after features. Another one which I would like to bring up is the Lead Qual...

    Read more
  • Early Opt-in for October 2019 Wave 2 Updates

    20 August’ 2019

    August 2, 2019 was when the Wave 2 Updates were to be out. And here we are! By now, you should have gotten the option to...

    Read more
  • Setting Unified Interface App Icons

    20 August’ 2019

    Default App Icons for typical D365 environment look like these.But here’s what you can do to change these to put...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.