Dynamics 365 CRM V9+ New Feature: Dependent Attributes in JavaScript

Dynamics 365 9.0 has introduced a new feature that enables adding field dependency with a JavaScript web resource. It gives below benefits

  1. It will restrict deletion of field(s) if it is being consumed in a js web resource. In earlier versions user was able to delete field(s) even if it is used in a js logic, and it causes exception in js execution.

  2. Dependent field(s) value will be available on form UI, even if it is not added on form. That’s right you don’t have to fetch its value from CRM now (earlier we have to fetch field(s) value using odata or web API if it is not available on form and its value is needed in js logic.)
    1. Field value(s) can be access through entity attribute {ie. Xrm.Page.getAttribute(“new_testfield1”).getValue();}
    2. Accessing value(s) of the field through control {ie. Xrm.Page.getControl(“new_testfield1”).getValue();} will cause an error (as we have not added a control on form).
  3. js web resources will be shown in field dependencies.

     

    To add attribute dependencies, follow below steps

    1. Open a web resource (from a solution, this option is not visible if you open a web resource from a form)
    2. Click on second tab (Dependencies), here second grid is for attribute dependencies. Click Add to start adding attributes.

    3. You can choose entities from picklist and start adding its attribute.

       

      Note: This dependencies tagging is different than

      1. “Non-Event Dependencies” feature available in Form Properties.

      1. “Dependencies” feature available in Handler Properties (Navigation: Form Properties -> Event Handler -> Click on Add or Update an existing handler).

     

    Happy Learning .

4 thoughts on “Dynamics 365 CRM V9+ New Feature: Dependent Attributes in JavaScript

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 )

Google photo

You are commenting using your Google 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