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

  • Pablo J. Cosimo Profile Picture
    Pablo J. Cosimo 50 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    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

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    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.

  • Bobins Bansala Profile Picture
    Bobins Bansala 95 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    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 ?

  • Bobins Bansala Profile Picture
    Bobins Bansala 95 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    Thanks Sir, it helped

  • Pablo J. Cosimo Profile Picture
    Pablo J. Cosimo 50 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    Did you try eventArgs.preventDefault();

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    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();

    }

  • Bobins Bansala Profile Picture
    Bobins Bansala 95 on at
    RE: Dynamics CRM 2011, prevent form reload after entity.save() call

    Someone please help urgently

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans