Dynamics 365 Best Practices – Web resource dependencies

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;

  1. Open your webresource that you are using on the form.
  2. Click Dependencies tab.
  3. To add web resource dependency click Add icon on the first grid.
  4. To add a field attribute dependency click Add icon on the second grid.
Advertisement

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

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