Skip to main content

Notifications

Announcements

No record found.

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

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

    Thank you for the update Alan, keep us posted

  • alan.abery Profile Picture
    alan.abery 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.

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

    I just got feedback from Microsoft support.

    See image.

    dialogDisplay.JPG

  • rthompson Profile Picture
    rthompson 1,530 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);
    });

  • alan.abery Profile Picture
    alan.abery 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

  • Verified answer
    Henry J. Profile Picture
    Henry J. 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

  • rthompson Profile Picture
    rthompson 1,530 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.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans