cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HS_Nico
Helper II
Helper II

navigateTo and Duplicate Detection

Hello, everyone,

 

When using the Xrm.Navigation.navigateTo function to create a new entity record, I face the following problem: the return value savedEntityReference is null when data records are merged using duplicate detection.

 

So if a new data record is created, you get it back. If the window is closed without saving, the value is null. If a duplicate is detected and the records are merged, the value is also null.

 

If a duplicate was merged, I would like to get the ID of the "new" record. Regardless of whether a new data record has been created or a suitable one already exists, I would like to continue working with the corresponding ID. 

 

Thank you for your help and best regards
Nico

4 REPLIES 4
HS_Nico
Helper II
Helper II

Of course, the same problem also occurs when you use the Xrm.Navigation.openForm function to create a new data record.

eleung83
Resolver II
Resolver II

If I understand correctly, are you looking to redirect the user to the master record if a record that they open has been merged with another record?

 

If that's correct, then you could perform a webapi query to retrieve the master id value of the record that the user is currently viewing, and then redirect the user to that record id if it has been populated. This redirect could happen multiple times though, if the master record has been merged again with another master record, and this merge action repeated again

HS_Nico
Helper II
Helper II

I'll try to explain my scenario and what I want to achieve:

I have the "customer request" entity. A record is created in this table via a custom connector for each customer request on my website. The customer provides his first and last name on the website. Now I want to create a new record in my customer table via a ribbon button on the top of the customer request form. To do this, I open the corresponding customer form with "Xrm.Navigation.navigateTo", which I already prefill with the first and last name. When the user saves the customer's record, I get the customer's GUID back and can write it to the "customer" lookup field of the "customer request" entity. However, if the duplicate detection takes effect and the user merges the "new" customer with an existing customer, I get nothing back and cannot fill the lookup field.

 

So now I have to somehow get the GUID of the already existing dataset. Unfortunately, the record is never opened to access the GUID.

eleung83
Resolver II
Resolver II

I would suggest looking at having a plugin that would trigger on the merge (or create/update as I would assume D365 would update the master id in the background or possibly add the master id to the target entity just before it would be created in D365) of the customer record. 

 

From the merge trigger you would have access to the original duplicate record being created and the master record it was being merged to, and you could also still get access to the original customer request entity so you could update it in the background with the final customer record.

 

If the merge didn't fire you could then still register another plugin on the create of the customer record to update your customer request record accordingly

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (4,159)