Modify Form fields from a Web Resource

In a custom entity, I have a Form from which I can call a web resource(HTML) that shows information retrieved from other entities to the user. If the user clicks on a specific button in the HTML, a field in the calling form must be changed. If you try to update a field from the web resource same as we do it in the form scripts(Using XRM Framework), this is not possible as the scope of the XRM Framework is directly related to the script in the form. So, to update any field in the form from a web resource, we should use the following code:

// Adding window.opener to our normal Xrm.Page object model
// to use Xrm it in the web resource(HTML)"FIELD_NAME").setValue(value);

By using window.opener, we’ll be able to use XRM object model same as we do it in the Form Scripts.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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