Below are the steps to show/hide the entities in the Regarding Field.
1. When we open the email form we can see “TO” lookup field has a list of many entities as shown below screenshot.
2. In Order to filter in “To” lookup field to display only account and user entities follow the below code to get the result as shown below screen shot.
function ToLookupFilter() {
if (Xrm != undefined && Xrm != null && Xrm.Internal != undefined && Xrm.Internal != null && Xrm.Internal.filterLookupTypes != undefined && Xrm.Internal.filterLookupTypes != null) {
//Showing Account and contact entities are shown in the "To" field.
Xrm.Internal.filterLookupTypes(Xrm.Page.getAttribute("to"), ['account', 'systemuser'], false);
}
}
3. The regarding field will be filter with account and contact in the below screenshot.
Hope this will be helpful.
