Web Resource Dependencies – New Feature in Dynamics 365 July 2017 Update. There are lots of new and exciting features introduced with July 2017 Update for Dynamics 365. Defining dependencies for Web Resources is one of them.A Solution is formed of different solution components like Entity, View, Web Resources, Reports etc. Component dependencies ensure that the deletion of thecomponent is prevented in case there is another component dependent on it. Also, the Solution, during export, lists down all the dependent components and warn theuser if any component is missing. The import of the solution fails if the dependent components aren’t there on the target system. Thus, component dependencies ensure that the system is always in a stable state. With July 2017 Update in Dynamics 365, we can now define dependencies between web resources, which wasn’t possible withthe earlier version of the product. In theprevious version, we didn’t have any option of specifying dependencies for Web Resources as shown below
In July 2017 Update, we can see a new tab named Dependencies added to Web Resource
InsideHTML Web Resource -
Inside JavaScript Web Resource -
We have this dependencies tab available for HTML and JavaScript type of web resources. For HTML Web Resource, we can define dependencies on another Web Resource of type
CSS HTML JavaScript RESX XML
In case of JavaScript Web Resource, we can additionally define dependencies on Entity’s attribute as well. Through this, we can ensure that all the fields or attributes that are being referred in the JavaScript are available in those Entities and we do not get any JavaScript errors, by preventing those fields from getting accidentally deleted. Once we have defined the dependencies, thesystem will make sure that dependent component is removed first before allowing any deletion. To see it in action, Login to Dynamics 365, Go to Settings Solutions and create a new solution and create a new JavaScript Web Resource. Here we have created a JavaScript Web Resource with Display Name “Sample Script” and schema name “new_sample”.
Click on Dependencies tab of the web resource created
Click on Add to define dependencies on the other Web Resources. The system will open Lookup Dialog Box from wherein we can select web resources on which this JavaScript component is dependent.Here we can select Web Resources of type CSS, HTML, JavaScript Libraries, RESX (Resource File) and XML as shown below.
Here we have selected an HTML Web Resource along with RESX and JavaScript Web Resource as dependent components.
Similarly, click on Add on the section below to it for defining Entity’s attributes as dependencies. From the Entity Attribute dialogue box, we can select Entity from the drop down and its corresponding fields will show up in Available Fields section. We can then select fields from the Available Fields and move it to Dependent Fields as shown below.
Below we have specified dependencies on fields of Account and Lead entity.
Now click on Save and then click on Publish to publish the changes. Once published, click on Show Dependenciesin the Web Resource, this will open up the Dependencies Dialog Box. Here we can see all the dependencies that we have defined, added as Required Components.
This way System ensures that when we import the solution which includes our JavaScript Web Resource, the required components should be added in the Solution being exported or the required components should already be present in the target system, else our Solution import will fail in that case. The other thing the system makes sure is if we are trying to delete any of the dependent components, it will not allow doing so. Let us try to delete an HTML Web Resource which we had specified as adependent component. In doing so we will get the below error which informs us that the component cannot be deleted as one or more components require it.
Click on “Details� link in the message, this will show us the component that requires it. As we can see it is listing our JavaScript Web Resource as acomponent that requires it.
Thus, system checks for the dependencies and ensures that we do not delete any component accidentally If we want to delete any of the dependent components we need to first remove the dependencies. In this article,we learned about the Web Resource dependencies, a new feature introduced in July 2017 Update. This feature comes as a welcome addition to the arsenal of System Customizer, System Administrator and the Developers working in dynamics 365 development which makes it one of the most robust platforms in the CRM World.
This Article is originally Posted on:http://aegissoftwares.over-blog.com/2018/01/web-resource-dependencies-new-feature-in-dynamics365-july-2017-update.html