JScript to disable search browsing does not work in CRM 2013

I am working with MS Dynamics CRM 2013, and I encountered the following problem: in CRM 2011, I turned off viewing and selecting an entity when searching using the following jscript:

document.getElementById("lookup_id").setAttribute("disableViewPicker", "1"); document.getElementById("lookup_id").setAttribute("defaulttype", "1"); document.getElementById("lookup_id").setAttribute("lookuptypenames", "account:1:Account"); document.getElementById("lookup_id").setAttribute("lookuptypes", "1"); 

But after moving to Dynamics Crm 2013, this script no longer works.

Can you help me in this matter. Thanks!

+7
javascript jquery dynamics-crm-2013
source share
3 answers

Try adding "_i" with the id attribute, for example,
contactid is your lookup attribute name, then you should pass as

 document.getElementById("contactid_i").setAttribute("disableViewPicker", "1"); document.getElementById("contactid_i").setAttribute("defaulttype", "1"); document.getElementById("contactid_i").setAttribute("lookuptypenames","account:1:Account"); document.getElementById("contactid_i").setAttribute("lookuptypes", "1"); 

In crm 2011, the attribute input identifier matches the attribute name, but in crm 2013, the input id attribute is the attribute name plus "_i" (possibly, "_i" stands for input).
I am trying to use this "_i" on camouflage and multiplexer lists perfect for 2013. Hope this helps in your case.

stack overflow

+3
source share

You can also disable it when setting up, In the form when editing a search

select "View Selector" β†’ off

0
source share

It is best to use an Xrm.Page object:

 Xrm.Page.ui.controls.get("lookup_id").setDisabled(true); 

Gareth Tucker has a great JavaScript link for Dynamics CRM .

Using the DOM is not directly supported in Dynamics CRM; the current code that you have may break again after installing the update. See JavaScript Best Pratices on this MSDN page.

-2
source share

All Articles