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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

UI // refresh webressource HTML

(0) ShareShare
ReportReport
Posted on by

Hello team,

Please, i have a question for UI.

Could you tell me how i can refresh an html webresource which exists in a tab from another tab? using javascript.

I'm available for more information.


Thank you in advance for your answers.

Zak

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    You should be able to do this by using the setSrc method. If you set the src to be the same as it already is, the webresource should reload. Note that you may need to include Meta tags in your html webresource to prevent it from being cached

  • Community Member Profile Picture
    on at

    Thank you Davide for your answer.

    Yes, I do use the setSRC method.

    I want to force the update of my webresource in the "resume" tab following the update event of a field in the "News" tab.

    Otherwise, I have to manually select the "Resume" tab for the web resource to update.

  • Suggested answer
    - Matt Bayes - Profile Picture
    890 on at

    Hey Zak,

    As mentioned, you can use the SetSrc method in order to reload the Web Resource.

    The control should be accessible via Javascript from whatever tab you are in.

    You would have to have some sort of code similar to this, which would be bound to the OnChange event of your field in the News tab:

    /* CREATE YOUR NAMESPACE */
    var Zak = window.Zak || { namespace: true };
    
    /* EXECUTE YOUR MAIN NAMESPACE FUNCTION */
    (Zak.Contact = function() {
    
        /* CREATE METHOD FOR ON CHANGE OF YOUR FIELD */
        Zak.Contact.Field_OnChange = function(executionContext) {
        
            /* RETRIEVE THE FORM CONTEXT */
            var formContext = executionContext.getFormContext();
            
            /* RETRIEVE THE WEB RESOURCE URL FROM THE NAME */
            var webResourceName = "zak_mywebresource";
            var webResourceUrl = formContext.getControl(webResourceName).getSrc();
    
            /* VERIFY WEB RESOURCE URL COULD BE FOUND */
            if (webResourceUrl) {
            
                /* ASSIGN URL OF WEB RESOURCE TO THE SAME URL */
                formContext.getControl(webResourceName).setSrc(webResourceUrl);
            }
        };
    
    })();

    Using the code above (or something similar) you can bind the function to the On Change event of your desired field and reload your web resource.

    Just make sure when binding to the On Change event you check the box for "Pass Execution Context as First Parameter" so that the Form Context can be resolved.

    If you have questions please let me know!

    If this solved your issue, I'd appreciate if you could set this question as answered!

    Thanks!

    Matt Bayes

  • Suggested answer
    Jomy Jose Profile Picture
    290 on at

    Use the below method.

    var formContext = executionContext.getFormContext();

       var Id = formContext.data.entity.getId();

       var globalContext = Xrm.Utility.getGlobalContext();

       var clientUrl = globalContext.getClientUrl();

               var control = formContext.ui.controls.get("WebResource_MultiCheque_Replacement");

               var recordurl_replacement = clientUrl + "/WebResources/md_MultichequeReplacement.Html?";

               params = "id=" + Id;

               var mainURLReplacement = recordurl_replacement + params;

               if (Id) {

                   control.setSrc(mainURLReplacement);

               }

  • Suggested answer
    Ambesh Singh Profile Picture
    145 on at

    Hello hamd,

    Simply update the iframe source url with same value, it will refresh your web resource., you can trigger on button click, or some other events too.

    Thanks,

    Ambesh Singh

  • Community Member Profile Picture
    on at

    Hello All,

    Thank you for your answers.

    Zak

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans