sales@dynamicsedge.com
202-410-6400

Dynamics CRM Add Lookup Dialog Training

Have you ever wanted to disable some of the buttons such as the "Remove Value" and "New" buttons on the Lookup Record dialog in Dynamics 365 for Customer Engagement?

Moreover, have you wanted to do this regardless of the underlying Entity permissions of the user i.e. you want to disable the button directly on the CRM User Interface?

As a reminder, the Lookup Record dialog shows up when using a "lookup field" and clicking on "Look Up More Records"

Dynamics CRM Lookup Field Training

After clicking "Look Up More Records" below, you get the Lookup Dialog that is shown at the top of this article.
Dynamics CRM Look Up More Records Training

Suppose that even though you already have users who have the proper permissions to make changes to an entity and its records, you may want to limit the functionality on the specific Lookup Record dialog, regardless of the actual underlying user privileges on the Entity.

You may have already tried things like changing the HTML attribute called disablemru, but even so it may seem like making this change through your browser's developer tools will not correctly disable the "Remove Value" button even on a temporary basis.

However, there is a way to disable the button. It is unsupported, but there is a way.

WARNING: This is considered unsupported by Microsoft. It is unsafe for production and you use this code at your own risk and responsibility.

In your browser's developer tools, you can try the following code snippet.


$("#btnNew",$("#InlineDialog_Iframe").contents()).attr("disabled","disabled");

This snippet has been tested on one of our demo CRM instances on 12-19-2018 and it appears to work correctly on our Microsoft Dynamics 365 Version 1710 (9.1.0.996) online. This snippet should successfully temporarily disable the "New" button, and the "New" button should look like in the screenshot at the top of this article with the functionality when clicking it successfully disabled.

Note - if you get a cross origin error from Chrome when running this script in Developer Tools, you may need to disable web security temporarily, something we never recommend you do - you can launch Chrome with --disable-web-security but make sure you do not use it for web browsing and only briefly use it to test the below scenario - close the web browser immediately after doing this, and make sure not to accidentally launch Chrome in this mode again for normal web browsing.

There's a lot more to this though than the above.

  1. First, you'll need to turn this into a custom web resource. This involves some advanced programming beyond the above code snippet above since again, it is unsupported functionality.
  2. In some cases, it may also be undesirable to have to worry about linking this to every form / view. You may want to attempt to link to the custom web resource globally for the whole CRM. Note that Microsoft does not officially have any way to support loading a Web Resource globally, and an additional unsupported workaround (which may or may not work in all cases, and may also require further advanced modification of the web resource) must be used. You might be able to skip this part and only do the first part, if you know you ONLY want to apply this modification on the Lookup Dialog when it pops up from the Lookup Fields that showed up on one or more specific forms only.

If you need any help with the above or have any further questions, use this link to contact us.
For more info on Microsoft Dynamics CRM (we hold classes on the newest Dynamics 365 for Customer Engagement, v8.2.2, v9.0.2 and higher, on-premises and online, AND the older Dynamics CRM 2016, 2015, 2013, 2011, 4.0), check out our Dynamics CRM Training Courses or call / contact us to design a custom course for you.

202 S.E. Church Street, Suite 203 Leesburg, VA 20175
https://www.dynamicsedge.com/
sales@dynamicsedge.com
Solutions
Company
202 Church Street S.E. , Suite 203 Leesburg, VA 20175
202-410-6400
800-453-596 (Toll Free)
sales@dynamicsedge.com