{Quick Tip} Restrict To Lookup of email to allow only a record in Dynamics 365

Restrict To Lookup of email to allow only a record in Dynamics 365

Nothing like real time requirements and here is another one. Customer walks in and puts in his requirement – “Users should not be able to select more than one record in the To field of CRM”. We suggested that while sending the email, we would put a validation which would stop the user from sending the email if more than one record is there. Well as everybody knows, more often than not, customer has his way and then we were back to the drawing boards trying to figure out how to do it.

For starters, To field in Dynamics allows you to select more than one record of multiple entity types which is obvious isn’t it. Below is the UI which allows you to do that.

image

 

Fortunately we found out a way. This is what we did.

  • Created a solution. Added Email entity and the To field to it.
  • Exported the solution
  • Unzipped the solution and opened up customizations.xml file in a XML editor.
  • Navigated to the area where To attribute is there in the XML file.

image

  • Added the below in the XML file just above <displaynames> tag.

<LookupStyle>single</LookupStyle>

  • Re-zipped the files. Imported the solution back and Publish all customizations.
  • And now when you click the To field, this is what you get.

image

 

Mission accomplished!

Hope this helps.

 

Debajit Dutta

(Dynamics MVP)

For training/ consulting, please write to us at info@xrmforyou.com

Advertisements

Published at Fri, 04 May 2018 15:23:09 +0000

Leave a Reply

Your email address will not be published. Required fields are marked *