Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Dynamic Lookup SetEntityTypes disables the Look For drop down list

(0) ShareShare
ReportReport
Posted on by

We have a solution that requires the Regarding field entities to be restricted based on an optionset (Selection Type).

This is being accomplished via the following javascript.

case "ACCOUNT SETUP AND MAINTENANCE":
Shared.SetLookupFieldFilter(formContext, "regardingobjectid", ['account', 'fst_customergroup', 'fst_salescontract']);

Shared.CheckRequestRegardingType('COMA - Contract Management', ['account', 'fst_customergroup', 'fst_salescontract']);

break;
case "CONTRACT AUDIT":
Shared.SetLookupFieldFilter(formContext, "regardingobjectid", ['fst_salescontract']);

Shared.CheckRequestRegardingType('COMA - Contract Management', ['fst_salescontract']);

break;
case "GLOBAL ID CREATION":
formContext.getControl("regardingobjectid").setVisible(false);

break;
case "GLOBAL ID REVIEW":
Shared.SetLookupFieldFilter(formContext, "regardingobjectid", ['fst_globalgroup', 'fst_salescontract']);

Shared.CheckRequestRegardingType('COMA - Contract Management', ['fst_globalgroup', 'fst_salescontract']);

break;

Shared.SetLookupFieldFilter = function(formContext, fieldName, entityArray) {

var lookupControl = formContext.getControl(fieldName);

if (lookupControl.getEntityTypes().length > 1) {
lookupControl.setEntityTypes(entityArray);
}
}

Everything seems to work correctly, until the optionset value is selected that only has one lookup entity.  At that point, it filters to only that entity and disables the Look For drop down list.  Any subsequent change of the Selection Type optionset to a value that has more than one lookup entity no longer works.  It still displays the entity from the single filter.

Any thoughts or ideas on how to clear the lock on the Look For drop down, or enable the entity list to be applied correctly?  I am unable to save, as the use may be in the middle of entering data into this custom request.

Thanks for your insight.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans