Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com
This is an old topic which is getting discussed since CRM 2011 or I think even before that. You must be wondering, why I am digging out history here. Well there has been so many blogs written about this.
So what’s the problem statement here?
Recently my customer wanted that whenever an email is being sent from Dynamics, it only needs to be sent through Queues. In other words in the From Lookup of the email, the user should not be able to select self or any other user from CRM.
So there are basically two steps to it. Since from is a multi-entity lookup, it shows both the user and queue when user tries to select.
So the first thing needed is to stop the user from selecting the user entity and the next is to stop the user from selecting any user record in from.
To achieve the first problem statement, so many blogs have been written but they use unsupported Javascript to meddle with the UI element and disable the dropdown. We will not do that here.
The other option, supported way, is to use the addCustomFilter. But with that, even though you stop from selecting a user, still the Entity selection of User/ Queue is available.
So wanna try something new? Let’s do this.
- Create a solution and add the Email entity to it. While adding the entity, to keep the solution simple, just add the from field to it (only for CRM 2016 and above. Prior versions, you are not luck to choose the options)
- Export the solution as Unmanaged
- Unzip the solution. You should see three file
- Customization.xml
- Solution.xml
- [Content_types].xml
- Open the Customization.xml in a XML editor of your choice and navigate to the section where the From field is present.
- You may find the unmodified=”1” in the attribute element as well as Email entity element. Remove the tags. Otherwise any changes you make here may not reflect in CRM once you import back.
- Scroll down a bit and you will see the section with the LookupType tag.
- Remove the entire element corresponding to 8 (Type code for user). Your final XML should just contain the one LookupType tag with Queue (2020).
- All set and done, select the three files and re-zip them
- Re-import the solution and publish all customizations.
- Now go back to your CRM email. Try to select “from”. And get the delight. Now entity selection is disabled and you are just left with selecting the queue.
Hope this helps!
Debajit Dutta
(Microsoft MVP)
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.
Why can’t you use the supported function setEntityTypes?
Hi Andy,
Thanks for reading my blog. As of the date I wrote this blog, I believe setEntityTypes was still not official. I believe it was made official somewhere in Oct 2018. May be wrong though 🙂
Cheers!
Debajit