Back to Basics # 39: Link Web resource to a Form using Classic UI in Dynamics CRM

Introduction:

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.

Step 1:

Login to the required environment and select required solution [Contact Customizations Solution in this case] as shown in the   below figure.

Step 2:

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.

Step 3:

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.

Step 4:

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.

Step 5:

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.

Step 6:

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.

Step 7:

After Step 6, new Handler properties window will be opened and there provide the following values as inputs

Library: cr5bc_contactform

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

Step 8:

After Step 7, click on ok button in Form Properties popup and then click on save and publish as shown in the below figure

Step 9:

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

Note:

  1. Make sure to publish all customizations and upload JavaScript (js) file.
  2. For other Forms for an entity we can add a web resource in the same way.
  3. Same process is applicable for Save Event as well.
  4. ContosoVaccination.Scripts.ContactForm.handleOnLoad method in Step 7 was taken from contact javascript webresource as shown in the below figure.

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

  1. Pingback: Back To Basics :Curated List of Articles in a Single Page – Common Man Tips for Power Platform, Dynamics CRM,Azure

  2. Pingback: Rewind January 2022 – Common Man Tips for Power Platform, Dynamics CRM,Azure

  3. Pingback: Rewind January 2022 - Microsoft Dynamics CRM Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s