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)

Refreshing iframe script performance

(0) ShareShare
ReportReport
Posted on by 7,316
 Hi,

I have an iframe which needs the current record id when it's saved initially. So to get the id, I've written a script to refresh the form so iframe gets reloaded and retrieves the saved record id. This script gets triggered on 'onsave' event. This works well but the only con is it pops this below message box sometimes not always though.  

"Your changes have not been savd. To stay on the page so that you can save your changes, click Cancel."

Here is the script:

function formRefresh()
{

setTimeout(function () { 
    // Call the Open Entity Form method and pass through the current entity name and ID to force CRM to reload the record
    Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId()); 
}, 500);
}

So I've registered the same script to trigger on 'onchange' of modifiedon field instead of 'onsave'.

This is also working great without any popup messages. But the script runs on every update on the form. It loads the form when save is hit for every update.

So, I would like to know your suggestions on which route to take. I would like to go with second approach but visually it always loads the whole form which I am not sure how inconvenient to the users. Or is there any other best approach if you have implemented in your projects.. please let me know.

Thanks for any help.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    You can check if the id of the record was available on form load or not. If it was available then you don't need to refresh the page as the iFrame already has the ID. If doesn't, then refresh the page.

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