Advertisements

DisableViewPicker not working in CRM 2013

In CRM we are often faced with the requirement of disabling the view picker of a lookup view.

Say we a have a lookup field called customerid on the form of another entity  and on click of the lookup, we need to disable the view selector of the lookup view window.

In Crm 2011 this could be achieved with the following code

$(“#customerid”).attr(“disableviewpicker”, “1”)

However in CRM 2013, you might find the  code above not working as expected. To do the same in CRM 2013, the trick is not find the image of the particular lookup field and  apply the code to the image tag.

$(“#customerid”).find(“img”).attr(“disableviewpicker”, “1”)

Hope this helps!

Advertisements

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

7 Responses to DisableViewPicker not working in CRM 2013

  1. ukcrmguru says:

    Why would you want to use unsupported code to do this, when you can set the properties of the lookup field on the form to restrict the view selection to one or several views, or lock it completely? And of course you can set this to different view(s) for different versions of the form, if that is useful.

    • Debajit says:

      Hi,
      Absolutely I agree to your point. However there are scenarios when selection of views are not available for the lookup field. Take an example of the customerid field in the opportunity entity where the lookup entity type can be of type account or contact and your business requirement would require you to restrict users to only account entity views. Here for the customerid lookup field you cannot configure OOB.

      Also similar is the case with the From lookup of the email. Actually in CRM, we do not have options for view selection of the the lookup fields when the field if of type multi entity.

      There i have found this code to be very useful.

      • ukcrmguru says:

        Ah, OK, I guess that makes sense. Also probably why some of the Customer fields are being replaced (slowly) by separate Account and Contact (eg on Opportunity), to avoid having to resort to this sort of thing.

  2. Not working for me , 😦

    • Debajit says:

      Hi Thanks for reading my blog. I tried it both in Crm on-premise and online and it works for me.
      Please note that this trick is required only for multi entity lookup. if you have single entity lookup, disabling view picker is achievable OOB.

      If you are looking at multientity lookup only, for an alternative you can try the following:
      $(“#customerid_i”).attr(“disableviewpicker”, “1”)

      Let me know if this works for you.

  3. Iair says:

    you can also disable it in customization, by selecting “View selector” as off

    • Debajit says:

      Hi,
      Agreed. However there are scenarios when selection of views are not available for the lookup field. Take an example of the customerid field in the opportunity entity where the lookup entity type can be of type account or contact and your business requirement would require you to restrict users to only account entity views. Here for the customerid lookup field you cannot configure OOB.

      From 2016, however this is made easy as the customerid is slowly replaced by the Account and Contact field

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: