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)

Refresh Parent Entity form when updating a field (in Parent form) from Child Entity using Javascript

(0) ShareShare
ReportReport
Posted on by

Hi everyone!

I am updating a field of the Parent Entity from the Child Entity's quick create form. So when the child record is saved , i use the CRM SDK to update a field in the Parent form.

I noticed that the updated value is displayed only with a refresh. I would like when i save the child record , to update the value and show it instantly , so i decided to refresh the parent entity form. I tried the 

Xrm.Utility.openEntityForm(parentEntityName,parentEntityId) but it opens new window. I want to close the Quick create form and then refresh the parent form where i return to.
Any ideas?
Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Hi,

     I don't think there is an Xrm method for this - you might, probably, figure out how to get back to the "parent" form through the window.parent.

     Or, since it's javascript, you might add a function to the window.top(might just add this as a web resource - you probably don't even need an event handler on the "parent" form):

     function OnQuickCreateClose()

     {

     }

     window.top.OnQuickCreateClose = OnQuickCreateClose;

     And might call that function from the onsave in your Quick Create.. although, you might want to add a timeout before calling refresh in that function (since you would want quick create to save the data first)

  • Suggested answer
    Luke Sartain Profile Picture
    1,266 on at

    I did something similar for this:

    var thisQuote = {

               entityType: "quote",

               id: Xrm.Page.data.entity.getId()

           };

    Xrm.Utility.openQuickCreate(entityname, thisQuote, null).then(function (outObj) { successCallBack(outObj) }, function (error) { console.log(error.message) });

    function successCallBack(outputObj){

    setTimeout(function () { Xrm.Page.data.refresh(); }, 500);      

    }

    The timeout is used to give the quick create form time to close when using turbo forms before it refreshes.  

    msdn.microsoft.com/.../jj602956.aspx

  • Suggested answer
    Vahid Samimi Profile Picture
    210 on at

    hi

    other solution is use subgrid event like this:

    var refreshForm= function () {Xrm.Page.data.refresh()  };
    Xrm.Page.getControl("Your SubgridName").addOnLoad(refreshForm);


  • Suggested answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Shak,

    As vahid suggested.

    If you have subgrid of child entity in parent form, When ever you update child record the grid will be refreshed, On Sub grid refresh event you can reload your parent page.

    Hemant

  • SP211 Profile Picture
    130 on at

    Hi Shak, is this something that can also be done via the Portal?  We have a similar scenario where we want to reload the portal page after a subgrid item has been edited.

    Thanks

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
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans