Back to Basics # 36: Creation of Web resource JavaScript Type in Dynamics CRM

Introduction:

In Dynamics 365 CRM, any functionality cannot be achieved through OOB [Out of Box] functionality, then first thing comes into mind was customizations. So, basic customizations can be achieved starting with Web resources (js type) under code especially through JavaScript. As a business case, a new web resource will be created in Contact Customizations Solution.

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, Click on + New button -> More -> Web resource as shown in the   below figure.

Step 3:

After Step 2, create a JavaScript file with name ContactFormScripts.js in visual studio code with the below code

if (typeof (ContosoVaccination) == “undefined”)

{

    var ContosoVaccination = {__namespace: true};

}

if (typeof (ContosoVaccination.Scripts) == “undefined”)

{

    ContosoVaccination.Scripts = {__namespace: true};

}

ContosoVaccination.Scripts.ContactForm =

{

    handleOnLoad: function (executionContext)

        {

        console.log(‘on load – contact form’);

        },

    __namespace: true

}

 as shown in the   below figure.

Step 4:

After Step 3, provide the following inputs

Upload file : upload a javascript file ContactFormScripts.js

Display name : contact

Name : contact [cr5bc_contact]

Type : JavaScript (JS) from Contact Form scripts

Description: contact js logic

And click on save as shown in the   below figure.

Step 5:

After Step 4, you will see contact web resource gets created in Contact Customizations solution , select newly created web resource and click on Publish as shown in the  below figure.

Note:

  1. Make sure to publish all customizations as well.
  2. Don’t forget to keep some code in java script web resource, otherwise you Dynamics will not allow you to upload empty js file.
  3. I have more concentrated on creation of web resource that’s why not explained about the code that is present inside JavaScript file.

Conclusion: In this way, one can easily create a web resource of type java script to perform customizations for a given business requirement.

2 thoughts on “Back to Basics # 36: Creation of Web resource JavaScript Type 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

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s