Creating Web Resource with a Lookup Control
Posted on 3/11/2018 12:45:00 AM by Levin, AricBusiness Solutions Development Dynamics 365 Dynamics CRM
A few years ago we had some requirements where we needed to pop up an html web resource where users could select a value from a related entity (in a manner similar to a lookup control). We originally developed this as a regular drop down and retrieving the values using Rest messages, but later on decided to change this and have the user click on a "lookup" style control inside the web resource to get this working.
In the recent weeks I saw a few posts in the community of people asking how to do this. In this article I will demostrate the logic of implementing this.
The Change Owner function contains the code snippet below which calls the dialog and also processes the changes from the callback of the dialog. I am using the Xrm.Internal.openDialog to open the web resource, and yes "I am aware that this is not supported", but this is still working in Dynamics 365 v9, and you can feel free to modify the calling of the web resource. Once the button is clicked the popup window will open.
Since this was used in a previous project that we had, there is a text box for comments and the lookup control that will need to be popped up.
When the user clicks on the lookup icon in the dialog window, an additional Lookup Record window will pop up on top of the original dialog window.
Select the User record that you want, and click the Add button to populate the values from the lookup window (as shown below):
Finally press the OK button to have the data from the lookup returned to the form, and update the original lookup field that is on the form (not required).
Navigate to original post to enter comments
Popular Blog Categories
- Business Solutions
- Cloud Platform
- Common Data Service
- Dynamics 365
- Dynamics CRM
- IT Solutions
- Office 365
- Online Services
- Power BI
- Power Platform
- PowerApps Component Framework (PCF)
- Skype for Business
- Small Business Solutions
- Unified Interface