web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Saving in Progress Dialog on JScript save

(0) ShareShare
ReportReport
Posted on by 25

Hi All

When a Lead is created and the Parent Contact is selected we force the Lead to be saved using JScript below.

function OnChange_ExistingContact()
{
if ( formContext.ui.getFormType() == FormType_Create )
{
var existingContact = formContext.getAttribute( "parentcontactid" );
if ( existingContact != null && existingContact.getValue() != null )
{
formContext.data.entity.save();
}
}
}

However in UCI this displays a dialog box below:

pastedimage1579837476990v1.png

Is there a way to suppress these messages?

The lead already shows that the Lead is saving in the background before the dialog is displayed and seems unnecessary and would be annoying to users.

In Classic UI the Lead saved as normal without the dialog.

Cheers

Alan

I have the same question (0)
  • rthompson Profile Picture
    1,532 on at
    RE: Saving in Progress Dialog on JScript save

    Hi alan.abery,

    I have a meeting tomorrow with Microsoft support on this same issue. This is my second meeting with Microsoft support on this  issue.

    https://community.dynamics.com/365/unified-interface/f/unified-interface-forum/377846/model-drive-app---formcontext-data-save-savemode-2-and-formcontext-data-entity-save-saveandclose-are-not-closing/1004268#1004268

    Will post tomorrow if they are able to help.

  • Verified answer
    Henry J. Profile Picture
    5,237 on at
    RE: Saving in Progress Dialog on JScript save

    Thanks rthompson, this indeed looks similar!

    Hi Alan,

    By any chance, can you share details about the logic you trigger on the Form OnSave Event?

    Depending on what you are doing, this could lead to multiple saves, as the Form OnSave Event is also triggered from code saves (formContext.data.entity.save or formContext.data.save).
    Have you considered using the preventDefault method to manage save in your own way and prevent multiple / looping saves?

    I'm not 100% sure that the root cause is identical to rthompson's, so I advise that you too open a Support Request here: https://admin.powerplatform.microsoft.com/support 

    Henry

  • alan.abery Profile Picture
    25 on at
    RE: Saving in Progress Dialog on JScript save

    Hi Henry

    There is nothing being executed in the form On Save event.

    However I found that there are various events that call formContext.data.entity.save(); so yes the Saving in Progress message is a result of multiple saves occurring in quick succession.

    What they were trying to do is save a lead as the user enters key data like First Name, Last Name, Contact, and other key data, so the save event gets called OnChange of these fields.  This worked well in Classic Web but in UCI it raises errors.

    I am not sure if preventDefault will help in this case as I believe it can only be called from the OnSave event.  So will look at refining the logic in the OnChange events.

    Cheers

    Alan

  • rthompson Profile Picture
    1,532 on at
    RE: Saving in Progress Dialog on JScript save

    Hi alan.abery,

    I have been working on this for a while.

    I been working with Microsoft support and they have not been helpful.

    I worked with them last Friday showed the issue.  They also asked me to use preventDefault() and that did not work.

    For now until they are able to result the issue.  I am using an action on my change events to get around this issue.

    var new_datatracking = {
        "new_caseid": caseId,
        "new_name": caseName.toString()
    };
    
    var displayMessage = "Changing All Data Templates to Setup Completed!  Please wait..."
    StandardFunctions.ProgressIndicator(displayMessage, 4000);
    
    StandardFunctions.callActionPlugin(new_datatracking, localInfo.serverUrl, () => {
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "incident";
        entityFormOptions["entityId"] = caseId;
    
        // Open the form.
        Xrm.Navigation.openForm(entityFormOptions);
    });

  • rthompson Profile Picture
    1,532 on at
    RE: Saving in Progress Dialog on JScript save

    I just got feedback from Microsoft support.

    See image.

    dialogDisplay.JPG

  • alan.abery Profile Picture
    25 on at
    RE: Saving in Progress Dialog on JScript save

    Ok so here is an update...

    I have managed to resolve the OnChange_ExistingContact issue as it was also setting the First and Last Names when the contact was selected which ended up calling save three times due to Save being performed OnChange of First and Last names.

  • Henry J. Profile Picture
    5,237 on at
    RE: Saving in Progress Dialog on JScript save

    Thank you for the update Alan, keep us posted

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 74 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 55 Most Valuable Professional

#3
Anthony Blake Profile Picture

Anthony Blake 43 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans