Web resources are one of the most important and crucial feature of Dynamics 365. It allows you to extend form customizations, the Sitemap, business logic, ribbon buttons and so on..
You usually refer to the controls(attributes) from Web resources to change their values, validate fields, trigger some events. But if at least one of those fields that you are referring isn’t placed on the form(hidden or shown), you will end up getting errors.
formContext.getAttribute("accountnumber").getValue();
Of course when you are writing your code, you are testing it and be sure that everything works well and that field is on the form. But after some time, you may end up missing that field on the form due to someone removed for some reason. To prevent this such error you can use Web resource dependency, so you can’t just remove the fields from the form if they are dependent to a web resource.
Here is how;
- Open your webresource that you are using on the form.
- Click Dependencies tab.
- To add web resource dependency click Add icon on the first grid.
- To add a field attribute dependency click Add icon on the second grid.

One thought on “Dynamics 365 Best Practices – Web resource dependencies”