Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Set Default Entity On MSCRM D365 Entity Lookup Type Field.

Community Member Profile Picture Community Member

Sometimes we have a problem for filtering only specific entity type on the lookup for collection of an entity. We write custom js code for the restrict specific entity on entity lookup.

 

Scenario-1: Filter only contacts entity on "to" field on the email form.curently "to" field as Parti-List type. This field contains "Account", "Contact","Entitlement","Facility/Equipment","Knowledge Article","Lead","Queue","User".we set only contact as a default filter using below js code.

1.Insial level show Email Form-

7532.orignal-form.png

function SetDefaultView() {

var customerControl = Xrm.Page.getControl("to");
// Check if multiple type dropdowns enabled for this lookup

if (customerControl.getEntityTypes().length > 1) {
// Set entity type to contact
customerControl.setEntityTypes(['contact']);
}
}

2) this code is called on form load.

3) After applying this code on form load we validate ToThis code.

2335.picturemessage_5F00_3osg4vcy.ela.png

4) This code also works on UCI Interface.

3513.picturemessage_5F00_cjhcrwev.gpe.png

You can feel free to ask any query regarding this blog.

Sumit Verma

Sr. Dynamic CRM Developer

Comments

*This post is locked for comments