Web Resource HTML Implementation In UCI

Recently I have found out below new client API:

getContentWindow – Returns the content window that represents an IFRAME or web resource.

It is use to get the control of web source and calling the internal method by passing the Xrm and FormContext during Form On Load.

Source: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/getcontentwindow

But there is a cons where user might refresh the web resource using right click and it won’t trigger the method.

Two ways to solve this issue at current moment:

  1. Pass required data through parameters –

Source: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-pass-multiple-values-web-resource-through-data-parameter

  1. Using parent.Xrm –

Source: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/getglobalcontext-clientglobalcontext.js.aspx

Personally I prefer method 1 in my opinion as parent.Xrm will be obsolete (I guess) in future.

Leave a Reply

Your email address will not be published. Required fields are marked *