Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
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

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,349 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,212 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans