In Dynamics 365 CRM, way to link Web resource to a Form was by using Classic form where we can attach a web resource to form. As an example, in Contact customizations solution for contact main form we see how to link web resource by registering to form load event using classic UI which most of the earlier versions of CRM before Unified interface.
Login to the required environment and select required solution [Contact Customizations Solution in this case] as shown in the below figure.
After Step 1, select Contact table and navigate to Forms section and at the top of the form using ribbon at the right side click on 3 dots … beside Show dependencies and select Switch to Classic as shown in the below figure.
After Step 2, a new window will open with classic UI interface with contact entity and select Forms and then double click contact Main form and a new popup opens with contact form as shown in the below figure.
After Step 3, in case Main form, click on Form Properties and a new popup will appear and under Event List section -> Form Libraries click on Add button as shown in the below figure.
After Step 4, a new lookup window popup and search for contact.js web resource and click on Add and as shown in the below figure.
After Step 5, you could see contactform webresource under Form Libraries and then under Event Handlers select the following
Control : Form
Event : OnLoad
And click on Add button as shown in the below figure.
After Step 6, new Handler properties window will be opened and there provide the following values as inputs
Function : ContosoVaccination.Scripts.ContactForm.handleOnLoad
and select pass execution context as first parameter check box and then click on Ok buttonas shown in the below figure
After Step 7, click on ok button in Form Properties popup and then click on save and publish as shown in the below figure
After Step 8, to test this open any existing or new contact record and can observe in console window on load – contact form text (contact related web resource will be loaded and we can keep a breakpoint) will be shown as shown in the below figure
- For other Forms for an entity we can add a web resource in the same way.
- Same process is applicable for Save Event as well.
Conclusion: In this way, one can easily link / refer a web resource in CRM Forms in entities easily using Classic UI.
5 thoughts on “Back to Basics # 39: Link Web resource to a Form using Classic UI in Dynamics CRM”
Pingback: Back To Basics :Curated List of Articles in a Single Page – Common Man Tips for Power Platform, Dynamics CRM,Azure
Pingback: Rewind January 2022 – Common Man Tips for Power Platform, Dynamics CRM,Azure
Pingback: Rewind January 2022 - Microsoft Dynamics CRM Community
Peculiar article, exactly what I wanted to find.
Very descriptive blog, I liked that a lot.
Will there be a part 2?