Search code examples
dynamics-crmcrmlookupdynamics-crm-365

How to auto-populate the look-up depends on the look up selected in Dynamic CRM?


I try using the workflow but it need to save the transaction before it populate, I try mapping it but doesn't work.

So I have a 3 Entities Expense,Vendor,Transaction.

In Vendor Entity I have a field of Vendor Name and a lookup field for Expense Category(Expense Entity).

In Transaction Entity I have a lookup for Vendor name and Expense Category, so when I select a vendor name in the lookup it will populate the lookup of expense category.

I already used the filter, yes it show the expense category depends on the vendor name selected, but the problem in there is I need to click the lookup field of expense tracker to show the value. I want is it will auto fill the lookup field without clicking it. Thank you


Solution

  • One of the way to achieve this is by using client side APIs. You may code something like that:

    Upon vendor change:

    1. Place a REST or Web API call to extract expense category ID and name
    2. Populate the expense category lookup with category ID and name using client side XRM API

    Another and much easier way is to create relationship mapping for expense category over vendor-transaction relationship. Then if user will create a transaction record using related entities area from within the vendor entity, the vendor and expense category both will get copied over the new record.

    For a relationship mapping example please have a look over these links:

    Save Time Entering Data into CRM by Mapping Fields between Records
    TUTORIAL: Relationship Mappings