When answering a Smart Form, it is possible for Users to be prompted to pre-fill the Smart Form with answers from a previous Form Response.
Pop-up prompting the user to use a previous Form Response as an answer template
When a user selects to use an available Form Response as an answer template, the answers from the Form Response take precedence over any Mappings that may be defined for the Smart Form.
Configuring Salesforce to Allow Previous Form Responses as Answer Templates
To enable the pop-up when launching a Smart Form, the following configuration must be done on the Salesforce Platform:
- One or more custom Lookup fields for the axsy_forms__Form_Response__cobject must be added to the object that is intended to run the Smart Form (e.g. WorkOrder or Visit).
- The above Lookup field(s) must be added to the Sync Scope Object Tree for the object that is intended to run the Smart Form
- Existing Form Response records that are to be used as templates can then be set to the above custom Lookup field(s). The Status of the Form Response record - draft, completed, abandoned, etc. - does not matter.
There is no out-the-box way to set the above Lookup fields automatically. It is up to each customer to create processes - automatic or manual - in their Org to set the Lookup field(s) that point to existing Form Response records per their business needs.
When launching a brand new Smart Form on the mobile app - i.e. users will not be prompted when continuing an existing draft response - if the mobile app detects the presence of one or more custom Lookup fields for the axsy_forms__Form_Response__c object, then the following steps are used to determine if a Form Response should be offered up as an answer template and, if so, which Form Response should be offered:
- If custom Lookup fields exist but they are all empty, then the User will not be prompted
- If one or more of the custom Lookup fields have a Form Response value, but none of them are for the Smart Form that is being launched, then the User will not be prompted. Example: the custom Lookup field has a Form Response for the "Meter Install" Smart Form yet the User is trying to run a "Filter Install" Smart Form.
- If one of more of the custom Lookup fields have a Form Response value for a Smart Form and they do match the Smart Form being launched then...
- If only one available Form Response matches, offer that Form Response as answer template
- If multiple Form Responses match, then offer the Form Response whose Form Version matches the Form Version of the Smart Form being launched.
- If multiple Form Response match, and multiple have matching Form Version, then choose from those whichever one is associated with the Lookup field returned first by Salesforce when fetching the object field metadata
- If multiple Form Response match, but none have matching Form Version, then choose from those whichever one is associated with the Lookup field returned first by Salesforce when fetching the object field metadata
Allowing more than one Lookup field to the axsy_forms__Form_Response__c object on the record running a Smart Form means that, in the scenario where a record may be setup to run several different Smart Forms, each can have it's own historical Form Response as an answer template. So, for example, a Work Order that has a "Meter Install" Smart Form can use one custom Lookup field to identify a previous Meter Install Form Response to use as its template. If the same Work Order record also has a "Filter Install" Smart Form, it can use a second Lookup field to identify a previous Filter Install Form Response to use as that Smart Form's answer template.