Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Please wait while saving is complete, restrict in MSCRM

(0) ShareShare
ReportReport
Posted on by 30

One of the JS saving Form forcefully, due to this getting "Please wait while saving is complete" OOB popup.

IMG_5F00_20220504_5F00_064755.jpg

Need to restrict/avoid/disable popup in MS CRM. How can we achieve this?

  • Banne Profile Picture
    30 on at
    RE: Please wait while saving is complete, restrict in MSCRM

    working fine now, Thanks you Steve Zhao

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Please wait while saving is complete, restrict in MSCRM

    Hi Banne,

    As your code shows, you invoke "formContext.data.save();" twice. This should be the reason why this popup disappear.

    It seems that you want to compare the date form another table with today and then set some fields' value.

    If so, you could delete the line "formContext.data.save();" at the end of the function. Something like this:

    function CheckIsFutureJCP(executionContext) {

    debugger;

    var formContext = executionContext.getFormContext();

    var d = new Date();

    var DateJour = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0);

    var todayDate = DateJour.format('yyyy-MM-dd');

    //var StartDateColl = new Date(formContext.getAttribute("nbk_date").getValue());

    var CheckInBtn = formContext.getAttribute("nbk_checkinbtn").getValue();

    var CheckOutBtn = formContext.getAttribute("nbk_checkoutbtn").getValue();

    var JCPLookup = formContext.getAttribute("nbk_jcp").getValue();

    if (JCPLookup == null) {

    return;

    }

    var JCPGuid = JCPLookup[0].id;

    var newJCPGuid = JCPGuid.replace("{", "").replace("}", "");

    Xrm.WebApi.online.retrieveRecord("nbk_jcp", newJCPGuid, "?$select=nbk_date").then(

    function success(result) {

    //var nbk_date = result["nbk_date"];

    var JCPdatecoll = new Date(result["nbk_date"]);

    if (JCPdatecoll == null) {

    return;

    } else {

    var JCPdateJour = new Date(JCPdatecoll.getUTCFullYear(), JCPdatecoll.getUTCMonth(), JCPdatecoll.getUTCDate(), 0, 0, 0);

    var JCPDate = JCPdateJour.format('yyyy-MM-dd');

    }

    //for Mark Complete Button

    if (CheckOutBtn == true && CheckInBtn == true) {

    if (JCPDate <= todayDate) {

    formContext.getAttribute("nbk_showmarkcomplete").setValue(799240000); //setting Yes value

    } else {

    formContext.getAttribute("nbk_showmarkcomplete").setValue(799240001); //setting No value

    }

    }

    //for Close Customer Visit Button

    if (JCPDate <= todayDate) {

    //alert("button enabled");

    formContext.getAttribute("nbk_isfuturejcp").setValue(799240001); //setting No value

    formContext.getAttribute("nbk_shonbkosecustomervisit").setValue(799240000); //setting Yes value

    formContext.data.save();

    // return true;

    } else {

    //alert("button disabled");

    formContext.getAttribute("nbk_isfuturejcp").setValue(799240000); //setting Yes value

    formContext.getAttribute("nbk_shonbkosecustomervisit").setValue(799240001); //setting No value

    formContext.data.save();

    // return false;

    }
    },

    function(error) {

    Xrm.Utility.alertDialog(error.message);

    }

    );
    }

    And if this JS code is triggered when the data is save(onsave event), please add preventDefault() method.

    Please refer to this blog:Cancelling save event based on the result of async operation - Andrew Butenko's Blog

  • Banne Profile Picture
    30 on at
    RE: Please wait while saving is complete, restrict in MSCRM

    function CheckIsFutureJCP(executionContext) {

       debugger;

       var formContext = executionContext.getFormContext();

       var d = new Date();

       var DateJour = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0);

       var todayDate = DateJour.format('yyyy-MM-dd');

       //var StartDateColl = new Date(formContext.getAttribute("nbk_date").getValue());

       var CheckInBtn = formContext.getAttribute("nbk_checkinbtn").getValue();

       var CheckOutBtn = formContext.getAttribute("nbk_checkoutbtn").getValue();

       var JCPLookup = formContext.getAttribute("nbk_jcp").getValue();

       if (JCPLookup == null) {

           return;

       }

       var JCPGuid = JCPLookup[0].id;

       var newJCPGuid = JCPGuid.replace("{", "").replace("}", "");

       Xrm.WebApi.online.retrieveRecord("nbk_jcp", newJCPGuid , "?$select=nbk_date").then(

           function success(result) {

               //var nbk_date = result["nbk_date"];

               var JCPdatecoll = new Date(result["nbk_date"]);

               if (JCPdatecoll == null) {

                   return;

               }

               else {

                   var JCPdateJour = new Date(JCPdatecoll.getUTCFullYear(), JCPdatecoll.getUTCMonth(), JCPdatecoll.getUTCDate(), 0, 0, 0);

                   var JCPDate = JCPdateJour.format('yyyy-MM-dd');

               }

                   //for Close Customer Visit Button

                   if (JCPDate <= todayDate) {

                       //alert("button enabled");

                       formContext.getAttribute("nbk_isfuturejcp").setValue(799240001);//setting No value

                       formContext.getAttribute("nbk_shonbkosecustomervisit").setValue(799240000);//setting Yes value

                       formContext.data.save();

                   // return true;

                   }

                   else {

                       //alert("button disabled");

                       formContext.getAttribute("nbk_isfuturejcp").setValue(799240000);//setting Yes value

                       formContext.getAttribute("nbk_shonbkosecustomervisit").setValue(799240001);//setting No value

                       formContext.data.save();

                   // return false;

                   }

                   //for Mark Complete Button

                   if (CheckOutBtn == true && CheckInBtn == true) {

                       if (JCPDate <= todayDate) {

                           formContext.getAttribute("nbk_showmarkcomplete").setValue(799240000);//setting Yes value

                       }

                       else{

                           formContext.getAttribute("nbk_showmarkcomplete").setValue(799240001);//setting No value

                       }

                   }

           },

           function (error) {

               Xrm.Utility.alertDialog(error.message);

           }

       );

       formContext.data.save();

    }

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Please wait while saving is complete, restrict in MSCRM

    Hi Banne,

    This popup would appear if you try to save while the form is already saving. Directly disable this popup probably not a correct way. Could you share you JS code?

    Here is a related link about this, you could have a look:

    In Dynamics CRM Unified Interface OnSave Event Doesn't Work - Stack Overflow

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans