Tray Embedded / Advanced Topics / Data Mapping / Using Dynamic Lookup Schema

Using Dynamic Lookup Schema

An example of when you might use this is if the operation you are mapping to has multiple types, and the required data will change depending on the type.

Dynamic lookup can also be used as an alternative to hardcoding when you need to get at nested values.

The Salesforce 'Create record' operation is a good example. In the hardcoded example we used it to create an Account, but you might also want your End User to be able to choose which type of record gets created - it could be a Lead, or a Contact.

In this case, your End User would be able to choose from a type drop-down in the Config Wizard:


The available fields then change depending on whether they choose 'Account':


Or 'Lead':


Or 'Contact':


Setting up a Dynamic Lookup

In the above example we first of all had to make sure that there was a Config value set for recordType in the source workflow:


This can be made available in the first screen of the Solution Editor. Note that because the config was set in the Record Type drop-down in the source workflow, the system has picked up that it is a DDL, and so will present the End User with the drop-down list of record types, as per the first screenshot at the top of this page:


Then when setting up the data mappings, having selected 'Dynamic lookup' as the method and Salesfroce as the service, we then choose Find Records as the operation:


For Which auth slot do you want to use for the DDL call? we choose the auth slot that was made when authenticating Salesforce in the source workflow (this will be automatically available)

For Which DDL lookup do you want to use? we can choose the 'private_list_object_fields' lookup, which will pull the available fields for the record type chosen. Note that only certain connectors will have operations like this available.

Of key importance here is Which config slot does the operation depend upon?. Here we set it depend on the recordType which we allowed the End User to select in the first screen.

Allowing users to enter custom values

When presenting users with drop-down lists it is also possible to allow them to enter an arbitrary custom value in a drop-down list, instead of choosing from one of the options:


This is done by ticking the Allow custom values box:


Note that this is turned off by default as, with some service operations, it can cause errors by allowing users to enter invalid values.