Filter LookUp: Set Regarding Lookup Entities

Let’s learn how to set entities under lookup field.

Let’s take an example of Regarding lookup of Task activity.

In the below image we can see that the regarding lookup contains multiple entities associated with it where a user can go and select any entity records.

Task Entity: Regarding lookup

To restrict “Regarding” lookup entities, we can use java script which would help us in populating only the needed entities.

(function () { }(window.LearningRefresh = window.LearningRefresh || {}));
(function (LearningRefreshFilter) {
LearningRefreshFilter.FilterRegarding = function (executionContext) {
var formContext = executionContext.getFormContext();
formContext.getControl("regardingobjectid").setEntityTypes(["contact", "incident", "account"]); //Regarding Lookup Field
}(window.LearningRefresh.LearningRefreshFilter = window.LearningRefresh.LearningRefreshFilter || {}));

We will need to call the java script “OnLoad” event of the Task activity main form.

The calling function should be LearningRefresh.LearningRefreshFilter.FilterRegarding

Save and Publish the changes.

Filter Regarding Lookup

Hope this helps!