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)

Dynamics CRM 2011, prevent form reload after entity.save() call

(1) ShareShare
ReportReport
Posted on by 95

I have requirement in which I am calling a script in OnLoad event and inside the script I have a Xrm.Page.data.entity.save();  that saves my form. Here, I am facing a problem that form keeps reload after the save operation. Kindly suggest a way so that I can prevent the reload in CRM 2011
Event-OnLoad
Script- function setDummyValue()

{

Xrm.Page.getAttribute("tdummyvalue").setValue("9811");
Xrm.Page.data.entity.save();

}

*This post is locked for comments

I have the same question (0)
  • Bobins Bansala Profile Picture
    95 on at

    Someone please help urgently

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hello,

    Please put check in your code, if your field don't have this value only then set it and save, otherwise don't so it will only reload once after save

    Try this

    if(Xrm.Page.getAttribute("tdummyvalue")!=null && Xrm.Page.getAttribute("tdummyvalue").getValue()==null)

    {

    Xrm.Page.getAttribute("tdummyvalue").setValue("9811");

    Xrm.Page.data.entity.save();

    }

  • Pablo J. Cosimo Profile Picture
    50 on at

    Did you try eventArgs.preventDefault();

  • Bobins Bansala Profile Picture
    95 on at

    Thanks Sir, it helped

  • Bobins Bansala Profile Picture
    95 on at

    Actually I want to show/hide a ribbon button using value display rule , for which I am setting a field value onLoad but the value of that field doesn't save to DB without the save operation and the value doesn't get the updated value from DB without the save operation. Please tell if there is any other by which I can give updated value in value Display rule ?

  • Mahendar Pal Profile Picture
    45,095 on at

    Can you share some details of your requirements?? for example if user opens a create case and you are setting the value, if it's not there already, from your Ribbon rule you can read and apply accordingly and when user will save record.

  • Pablo J. Cosimo Profile Picture
    50 on at

    Check for Xrm.Page.ui.getFormType() ==2. If you are creating a new register the form type will return 1, after the first save and refresh will be 2, so it wont keep restarting.

    Hope it helps.

    technet.microsoft.com/.../gg327828(v=crm.5).aspx

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