Wednesday, October 17, 2018

Filter available entities in regarding field

My customer wanted to filter the entities which can be selected in the Regarding field to only few.
Fortunately there is a supported way in the latest version of Dynamics 365. Here is the short tip:

Create a js webresource:

function setregardingcontext(executionContext)
{
var formContext = executionContext.getFormContext();
formContext.getControl('regardingobjectid').setEntityTypes(['opportunity','account']);
}

Then you need to call this function, so in the form, add the library to the form and create an Onload event
Insert the function setregardingcontext and do not forget to tick the checkbox which enables context sending.

I tested it and it work is the classic UI and in the Unified interface as well. It is also supported in the interactive forms, but it does not work in the Dynamics 365 App for Outlook. I will be contacting Microsoft Support regarding this. Keep watching for the update.

No comments:

Post a Comment