Support / Unsupported way to remove new button from inline lookup crm 2013/ 2016

By : Raghav
Source: Stackoverflow.com
Question!

Is there any Supported / Unsupported ways to remove new buttons from inline lookup in crm 2013/ 2016 ?

I don't want to do it via security role way.

Also from the loop up window?

By : Raghav


Answers

Strictly unsupported, but doable via straight DOM manipulation.

I don't have working code at hand, but the ID of what you need to hide is Dialog_<AttributeName>_IMenu in CRM 2016 Update 1

By : Alex


There is no supported way apart from what you mention: Remove the Create privilege for the given entity.

By : Henrik


The quick and rather dirty replacement of .html() has a couple of downsides.

  • it will actually replace the entire DOM structure, removing any event bindings if these are not bound 'live' on an element higher up the hierarchy
  • it will replace a lot more than you may expect. You should be safe with 'James' to 'Jamie', but it may get funky when 'em' wants to be named 'emmy' and suddenly certain italic texts get straightened out.

A better way is to replace only strings in actual text nodes, as jQuery is not (currently) a tag on the question, I assume vanilla javascript is a proper option.

var walker = document.createTreeWalker(
  document.body,
  NodeFilter.SHOW_TEXT, {
    acceptNode: function(node) {
      return NodeFilter.FILTER_ACCEPT;
    }
  },
  false
);

while (walker.nextNode()) {
  walker.currentNode.data = walker.currentNode.data.replace(/James/g, 'Jamie');
}
<!--  James  -->
<div data-name="James" class="James">
  James
</div>

This example will only touch the actual text element(s), the comment and both the attributes (data-name and class) will not get replaced, so it remains safe to have javascript and/or css referring to these.



This video can help you solving your question :)
By: admin