web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

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

venkatsr Profile Picture venkatsr User Group Leader

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.


This was originally posted here.

Comments

*This post is locked for comments