web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Refreshing the Web Resource in Dynamics 365

(1) ShareShare
ReportReport
Posted on by 17,078

Hi All,

I am trying to refresh the HTML web resource on the form on change of a field (date time field) in dynamics 365. I used the code below.

var webResource = Xrm.Page.ui.controls.get("WebResource_OnlineMeetingForm");
webResource.setSrc(webResource.getSrc());

But it's not working.

The screenshot of the form is shown below.

1768.3.png
On the change of the start time field (date time field), I need to refresh the table (HTML web resource) and display the meetings on that date.

How shall I do this?

Any help is appreciated.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at

    What happens when you clear the source and set the source again?

  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    It really worked when I cleared the source and set the source again. The code is shown below.

    var webResourceControl = Xrm.Page.getControl("WebResource_OnlineMeetingForm");
    var src = webResourceControl.getSrc();
    webResourceControl.setSrc(null);
    webResourceControl.setSrc(src);

    Thank you very much Gopalan Bhuvanesh.

  • Seenivasan M Profile Picture
    307 on at

    Hi All,

    I am getting null value on this,

    "var webResourceControl = Xrm.Page.getControl("My Web resource name");"

    Please help me on this.

    Note:

    My web resource place inside Form Header.

    CRM Version: D365 8.2v

    Thanks in Advance.

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Seeni,

    Make sure the name of the web resource is prepended with WebResource_  (eg: WebResource_YourWebresourceName).

    Hope this helps.

  • Seenivasan M Profile Picture
    307 on at

    Hi Nithya,

    Thanks for your response.

    Yes. I have prepended "WebResource_" with my Web resource Name.

    Ex: WebResource_test

    But, I am getting null value.

    Thanks.

  • Seenivasan M Profile Picture
    307 on at

    Hi Nithya,

    Its working when i place the web resource inside the form.But my Html web resource placed inside form header and its giving null value. Anything needs to be added if web resource placed inside Header?

    Thank.

  • acraigx Profile Picture
    on at

    Does this work in v9.0?  I had the same code working in 8.2 but now it appears to be failing.  I assume this needs to be rewritten using executionContext.

  • Robert_K Profile Picture
    25 on at

    Try this

    function refreshWebResource(executionContext, WebRrscName) {
        var _crmForm = executionContext.getFormContext();
        var webResource = _crmForm.getControl(WebRrscName);
        if (webResource != null) {
            var webResourceSrc = webResource.getSrc();
            webResource.setSrc(null);
            webResource.setSrc(webResourceSrc);
        }
    }

    on form field event handling

    check execution context as first argument and set "WebResource_YOURNAME" as second argument.

    5554.Firefox-Developer-Edition.png

  • Robert_K Profile Picture
    25 on at

    If you find the answer as useful, please mark it as verified.

  • Community Member Profile Picture
    on at

    Hi,

    Does anyone know a solution for Unified Interface? What is provided here works on classic interface but not Unified Interface

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Wayne Walton Profile Picture

Wayne Walton 2

#2
Good.Panos Profile Picture

Good.Panos 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans