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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Web Resource not getting refreshed in crm 2016

(0) ShareShare
ReportReport
Posted on by 675

Hi All,

I have 1 web resource and I show some records in it. Upon creation / deletion of records externally; the web resource will show the current state. So i have added a 'refresh' icon on that web resource that gives call to the below function.

<a title="" class="plus" id="refreshAll" style="margin-right: 5px;" onclick="RefreshWebResource();" href="javascript:;"></a>

function RefreshWebResource() {

var webResourceControl =Xrm.Page.getControl('WebResource_ProductPrice');
var src = webResourceControl.getSrc();
//webResourceControl.setSrc(null);
//webResourceControl.setSrc(src);
src = src + "%26reload%3dyes";
webResourceControl.setSrc(src);
}

but the web resource is not getting refreshed. Upon refreshing the whole page by pressing F5, it works. But I want to only refresh the web resource.

Any pointers please.

Regards,

Prashant

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Clem Profile Picture
    2,541 on at

    Hi,

    What about the ootb refresh function ?

    Xrm.Page.getControl(arg).refresh() msdn.microsoft.com/.../gg334266.aspx

    (sorry this is for subgrid, i answered too fast ...)

    What if you set the control to null first and then push the new src ?

    Clément

  • VPrashant Profile Picture
    675 on at

    Hi Clement,

    var webResourceControl =Xrm.Page.getControl('WebResource_ProductPrice');

    var src = webResourceControl.getSrc(); ------------- Exception

    Uncaught TypeError: Cannot read property 'getSrc' of null

       at RefreshWebResource (ProductPrice.htm:282)

       at HTMLAnchorElement.onclick (ProductPrice.htm:90)

    This is the exception that was caught.

    Why my webResourceControl is null I am not able to understand that? :(

    -Prash

  • Verified answer
    Clem Profile Picture
    2,541 on at

    does you javascript is embedded into an html file ?

    Then you need to make sure that you call the parent.Xrm ...

  • VPrashant Profile Picture
    675 on at

    Hey Clement,

    Adding Parent.Xrm did the thing. :)

    var webResourceControl =parent.Xrm.Page.getControl('WebResource_ProductPrice');

    var src = webResourceControl.getSrc();

    webResourceControl.setSrc(null);

    webResourceControl.setSrc(src);

    }

    Thanks a lot Clement. :)

    - Prash

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans