locked
Refresh HTML webresource data values RRS feed

  • Question

  • I have a HTML web resource on a form that displays the calculated value of two fields:

    Field "Current Price" 
    Field: "VAT"

    I've managed to display the calculated value on the HTML Form; however if the calculations change, I cannot see the new value on the form without actually refreshing the whole form. I was told that it is possible to reload the data without refreshing the form or the HTML, so how can I go about doing this? Also, the most important question is - is it supported?

    Wednesday, October 30, 2013 10:59 PM

All replies

  • Check this approach http://www.develop1.net/public/post/Calling-a-function-in-a-Html-Webresource-from-another-Javascript-Webresource.aspx

    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    Wednesday, October 30, 2013 11:27 PM
  • I came across that method earlier but I don't think it is supported in 2013, so no longer works. I tried the same script in 2011 using the above and it works there.

    Does anyone else have a suggestion?

    Thursday, October 31, 2013 7:33 AM
  • In the onChange event for both Current Price & VAT add the following code ,

    Xrm.Page.getControl("webresource").setSrc(Xrm.Page.getControl("webresource").getSrc());

    This will effectively refresh the html webresource & is supported. 


    John Grace (North52) Simplifying CRM & xRM development
    How? Check out the Free Standard Edition of N52 Formula Manager at www.north52.com

    Thursday, October 31, 2013 10:52 AM
  • The only supported cross-browser method that works without the reload and blink method is to use a an interval times javascript on the HTML form. The interval timer reloads the data at whatever time you set it. Values update automatically without the blink/reload.

    As for performance hit; I setup 7 webresources and got them to reload heavy calculations, they all did so without a hitch. 

    Thursday, October 31, 2013 2:19 PM
  • It should work in CRM 2013 as well.

    Note I do know that the CRM team is carrying a bug from the beta into the released version where if the webresource has not been set in the page load event then the suggested code will not work. The CRM team have confirmed the fix & this should be available when UR1 for CRM 2013 is released.

     So can you make sure that the iframe is getting set initially in the page onload event of the form so that from then on when either of the 2 fields change the suggested code will effectively refresh the webresource.


    John Grace (North52) Simplifying CRM & xRM development
    How? Check out the Free Standard Edition of N52 Formula Manager at www.north52.com

    Thursday, October 31, 2013 2:22 PM
  • John, I've know about your method but I've always received that "blink" effect which I dislike. Are you saying that the code you posted now works in CRM2013, without the blink effect? If that is the case that it's what I'll move towards.
    Thursday, October 31, 2013 2:29 PM
  • It will still have the blink effect no matter what version of CRM you are on.

    One way to clean this up is to have a loading image appear while the web resource is refreshing itself just something as simple as a 16x16 animated gif which you just make visible \ in-visible when needed. Much the same idea as this article,

    http://mscrmblog.net/2013/10/17/crm2011-set-iframe-loading-gif-before-load/


    John Grace (North52) Simplifying CRM & xRM development
    How? Check out the Free Standard Edition of N52 Formula Manager at www.north52.com

    Thursday, October 31, 2013 2:41 PM
  • Yeah I thought so. I think I'll stick with the interval method. It's instant, no blinking either.
    Thursday, October 31, 2013 2:58 PM