You can now prefill your form fields with data, by simply typing the keywords based on which the information will be retrieved from Salesforce. Let’s take a look at a couple of scenarios to better understand how the dynamic prefill works.
1. Let’s say that you want to type an email address and prefill the form fields with some information found in one of your Lead records, where that email address exists.
The first step is to set up a lookup. Here you have to take into account the fields based on which the search will be made (in this case the email is the filter) and the information you want to be returned.
The second step is to define the prefill. Follow the steps below to see how is this done.
1. Select the lookup you just created.
2. The trigger has to be the field you used as a filter when you set up the lookup. Why? Because you want to prefill form fields with data from your Salesforce record that contains that specific email address. Also, the field that is a trigger will always be highlighted.
3. For this specific scenario, you will want to load the data when the user starts to type.
4. Then map the form fields that will be prefilled and choose from what Salesforce fields that data will be retrieved.
2. Now, let’s take another example. You have a list of records in Accounts and you want the account names that pertain to each record to be loaded on the form. The question is why would you need to do this. The answer is very simple – you can choose from this entire list an account name and prefill form fields with data from the same record.
The same as for the previous example, the first step is to create your Lookup, but this time you won’t have any filter. The reason is that you want all account names from Accounts to load.
What changes in this scenario, in terms of prefilling options, is that you will load the data when the form is loaded (this is necessary if you use a dropdown field to contain the list of information). Also, the trigger will be as you can see in the image below, the Name field (dropdown field) because there is where we want all the account names displayed.
That’s it. Now you can easily retrieve data from your Salesforce records and pre-populate the form fields as you wish.