27/10/2017

Dependent Lookup in MS CRM 2016 and D365

Dependent Lookup in MS CRM 2016 and D365

Requirement: When a value selected in a lookup, related records for that lookup should be filtered in another lookup.

Eg: let’s say, we have Out Of SLA Reason and Out Of SLA Sub Reason lookup (entities). When a value is selected from Out Of SLA Reason Lookup, only related records of that value should be visible in Out Of SLA Sub Reason lookup.

Implementation:

  • Create two custom Entities – Out Of SLA Reason and Out Of SLA Sub Reason
  • Create a 1: N relationship (Referential) in Out Of SLA Reason with Out Of SLA Sub Reason. Which creates a lookup of Out Of SLA Reason in Out Of SLA Sub Reason entity.
  • Now go to Out Of SLA Sub Reason form and Out Of SLA Reason lookup on the form.



  • Now populate the data in Out Of SLA Reason and Out Of SLA Sub Reason.
  • Once data populated, go to Out Of SLA Sub Reason and select the related SLA Reason records from lookup for Out Of SLA Sub Reason records.
  • Now go to SLA Reason, SLA Sub Reason entities and create 1: N relationship (referential) to related entities.
  • Eg: If we want to show these lookup on Case. Create 1: N relationship (referential) from Out Of SLA Reason and Out of SLA Sub Reasons to Case entity. Which creates two lookup on Case entity.
  • Open case form and add these two lookup on the form.
  • Open Field Properties of Out Of SLA Sub Reason lookup from case form and go to Related Records Filtering section. Click on Only Show records where, choose Out Of SLA Reason (cases) and in contains Out of SLA Reason (Out Of SLA Sub Reason).

Now, when we click on Out Of SLA Reason and selects a record, only related records of that will show on Out Of SLA Sub Reason.