Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Unanswered

Bypassing the unsaved changes dialog when navigating away from a record in javascript - possible?

Posted on by 5
0

We are implementing a custom duplicate detection handler off the save of a new contact record in D365. It is being done via Javascript. In the JS OnSave method, we stop the default save action and do some checks via WebAPI to determine whether this may be a duplicate or not.

If no potential duplicates are detected, we manually call the save again in JS.

If some potential duplicates are detected, we display a HTML web resource listing the possible duplicates.

What we are trying to achieve is that the user can double-click on one of the potential duplicates and we will navigate them directly to that other contact record without saving the record that the user was keying in originally (the whole point of this is not to save the duplicate record). We are using the Xrm.Navigation.openForm command to achieve this.

The problem is that by default this displays a popup to the user asking them if they wish to save their changes first before leaving the page. Once they have interacted with this dialog -> it does navigate them to the other record but clearly this is a non-runner in terms of useability (and they can still choose to save the record first anyway).

Is there any way for me to achieve the programmatic navigation to another CRM contact record whilst already being in a CRM contact form in creation mode?

I can't seem to find any way to hide that default dialog.

 

The only workaround I can think of is to actually do the save in the background, whilst setting some kind of deletion flag. And I then delete it subsequently straight away afterwards.

But that seems very messy.

Any ideas?

Thanks

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans