Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Refresh parent page from the dialog in dynamics 365

Posted on by 505

I'm opening a dialog using Xrm.Utility.openDialog method. 

Is there a way to refresh the parent page when a button is clicked in the dialog?

*This post is locked for comments

  • Priyank Bhavsar Profile Picture
    Priyank Bhavsar 505 on at
    RE: Refresh parent page from the dialog in dynamics 365

    Callback function is somehow not working. Xrm.Utility.openEntityForm(entityName, id) serves my purpose.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Refresh parent page from the dialog in dynamics 365

    Hi Priyank,

    Try with this - 

    
    
    if ((window.opener && (typeof window.opener !== "undefined")) && (window.opener.Xrm && (typeof window.opener.Xrm !== "undefined"))) {
        window.opener.Xrm.Page.data.refresh(); // You can also write like below to reload--Xrm.Utility.openEntityForm(entityName, id) 
    
    }
    
    // Or you can also try
    
    if ((window.parent && (typeof window.parent !== "undefined")) && (window.parent.Xrm && (typeof window.parent.Xrm !== "undefined"))) {
        window.parent.Xrm.Page.data.refresh(); 
    
    }


    I am not sure , I have not tried , however I would suggest try to debug and write(window.parent.Xrm or window.opener.Xrm or may be window.praent.opener.Xrm) in  console when you are getting parent Xrm object. Once you get the object you can do refresh using 

    Xrm.Page.data.refresh() 

    or
    Xrm.Utility.openEntityForm(entityName, id)
  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Refresh parent page from the dialog in dynamics 365

    Priyank,

    Have you tried to use callback that is called when dialog is closed?

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Refresh parent page from the dialog in dynamics 365

    You can pass a callback function to openDialog, which will be called when the dialog is closed, and in the callback you can call the Xrm.Page.data.refresh method. However, there's no supported way to attach code to button clicks within the dialog

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans