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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Merge Permission

(0) ShareShare
ReportReport
Posted on by 30

How I can prevent merging records in CRM Dynamics?

I know there is a merge permission that can be removed from security role, but it works only for existing records for example if I already have 2 contacts in CRM and I made an update to one of the record then duplicate detection message will pop up and if user click 'Merge' then security message will be presented to user preventing them from merging contacts.However, if user will create a new contact then permission message is not presented and user can merge contacts. How to completely disable merging?

I have the same question (0)
  • Suggested answer
    Torrado Profile Picture
    1,270 on at

    Hello,

    you can write a Plug-In, triggering on Merge message.

    Please refer to this thread: community.dynamics.com/.../791295

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

  • q1938484 Profile Picture
    30 on at

    I don't think I can write such plugin because when I'm creating a new record (not commited to database yet), and after I click save the merge popup window appears, however the custom message is ignored (not showing), so I think in this case the plugin is looking for context.MessageName == "create" instead of "merge", am I doing something wrong?

            public void Execute(IServiceProvider serviceProvider)
            {
                try
                {
                    IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
     
                    if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
                    {
                        Entity entity = (Entity)context.InputParameters["Target"];
     
                        if (entity.LogicalName == "contact" && context.MessageName.Equals("merge", StringComparison.InvariantCultureIgnoreCase))
                        {
    						throw new InvalidPluginExecutionException("You can't merge!");
                        }
                    }
                }
                catch (InvalidPluginExecutionException e)
                {
                    // catch exception
                    throw new InvalidPluginExecutionException("An error has occurred: "   e.Message);
                }
            }

    Plugin is registered on Create and Merge as PreOperation

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
BillurSamdancioglu Profile Picture

BillurSamdancioglu 95 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans