Refresh IFrame in Dynamics 365 UI or UCI

Hi,

We all very used to write the piece of the code from this link whenever we need to refresh the IFrame in CRM.

Very unfortunately, the same code is not working in Dynamics 365 UI version 9.x on wards. No need to worry on that, we have the work around for the same.

We have to pass the WebResource name if it has the full URL and vice versa. Here is the piece of the code for the same. I know, it is little confusion but we have live with it until the PG Team fixes the issue.

                var src = null;
                var newsrc = null;
                var url = Xrm.Utility.getGlobalContext().getClientUrl() + “/WebResources/”;
                var iFrameName = “IFramControlName”;
                var IFrameControl = formContext.getControl(iFrameName);
                src = IFrameControl.getSrc();
                IFrameControl.setSrc(null);
                if (src.indexOf(url) != 0) {
                    newsrc = url + src;
                }
                else {
                    newsrc = “abc.html”;
                }

                IFrameControl.setSrc(newsrc);


Hope this helps.


Happy CRM’ing

Gopinath

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