Use a Repeatable Destination to Update Existing Child Records in Salesforce

This recipe shows you how to update Calibration Test records associated with a Salesforce Case. You’ll set up a form to include a Repeatable SectionClosed A Repeatable Section is a subform that contains a set of related questions. The data captured is “repeating”, because the field user can complete the same subform more than once, which creates multiple entries. so that users can enter the calibration details as line items in a table. You’ll also set up two Data SourcesClosed Data sources, also known as "Lookups", are external sources of data that you upload or connect to TrueContext. You can reference this data in a form to populate answers or answer options. Data sources save typing, reduce errors, and make it easy to provide mobile users with only the relevant, most current data. and two Salesforce Data DestinationsClosed A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats., one Regular and one Repeatable DestinationClosed A Repeatable Destination is a TrueContext Data Destination that sends data from a Repeatable Section to a field-based, third-party system.. Then, you’ll submit the form to see the results in Salesforce.

Available on the Advanced and Enterprise tiers:

Essentials
Advanced
Enterprise

Prerequisites

  • Your TrueContext account must be on the Enterprise or Advanced tier.

  • You must be a TrueContext Admin user.

  • You must meet the requirements to set up a Salesforce Connection.

  • You must know how to set up Salesforce objects and records with lookups to establish parent-child relationships.

Scenario

In the field, your service technicians perform equipment calibrations as part of their preventive maintenance tasks. Your back office maintains records of this work in a custom “Calibration List” object linked to a standard Case object.

In this scenario, the Case and Calibration List records and their lookup relationships already exist in Salesforce.

Info:In this recipe, you don’t need to set up the TrueContext Data Destinations as parent and child.

You can use the TrueContext Repeatable Sections, Regular Destinations, and Repeatable Destinations to:

High-level process

System Action Result
Salesforce Create a custom “Calibration List” object. This object stores the line-item data from the Repeatable Section in the form.
Link the Calibration List to the Case object. This makes the Calibration List details available from the Case view.
TrueContext Set up two Salesforce Data Sources, one for the Case records and the other for the Calibration List records. These prepopulate the form with the IDs and other data from the existing Case and Calibration List records.
Build a form that includes a question to capture the Case record ID. When the technician selects the case number from a Dropdown question, the associated Case ID gets pushed to another question in the form.
Add a Repeatable Section to the form. The technician enters the calibration test details as line-item entries.
Set up a Salesforce Case Data Destination. This is the initial Regular Destination that updates the Salesforce Case record.
Set up a Salesforce Standard, Custom, or Big Object Data Destination for the Calibration List. This is the subsequent Repeatable DestinationClosed A Repeatable Destination is a TrueContext Data Destination that sends data from a Repeatable Section to a field-based, third-party system. that updates the Calibration List records.
Associate the two Data Destinations with the form, and then deploy the form.

When the user submits the form, the Data Destinations run sequentially.

The initial destination updates the Case record, and the subsequent destination updates the Calibration List records.

Step-by-Step

In Salesforce

Create a custom “Calibration List” object with a lookup to the parent “Case” object.

Calibration List custom object, Fields & Relationships view with a lookup to the Case object configured

In TrueContext

  1. Set up a Salesforce Data Source to send the Case data from Salesforce to TrueContext. This example uses a SOQL query. Name this Data SourceClosed Data sources, also known as "Lookups", are external sources of data that you upload or connect to TrueContext. You can reference this data in a form to populate answers or answer options. Data sources save typing, reduce errors, and make it easy to provide mobile users with only the relevant, most current data. “Cases”.

    Salesforce Query Data Source, Connection tab, with Query details to get Case information to use in a form

  2. Set up another Salesforce Data Source to send the Calibration List data from Salesforce to TrueContext. This example also uses a SOQL query. Name this Data Source “Calibration List”.

    Salesforce Query Data Source, Connection tab, with Query details to get Calibration List information to use in a form

  3. In your form, add a “Case number” dropdown question that uses the Cases Data Source. Configure this question to push data to the Case ID question.

    Dropdown "Case Number" question with the following options: Use Data Source for Options, "Cases" Data Source, Populate questions in the main form, mapping to populate the "Case ID" question with data from the Salesforce "Case" record

  4. Add a Repeatable Section to the form:

    Add a Section > Repeatable

    Repeatable Section Information that shows the Unique Identifier

    Tip:Take note of the unique identifier to use in step 7a.

  5. Add an “Equipment Name” dropdown question that uses the Calibration List Data Source. Configure the Equipment question to push data to the Equipment ID and Model questions.

    Repeatable Section Builder example that shows the Summary Table with Calibration ID, Equipment, and Model columns. The "Equipment" question uses options from the "Calibration List" Data Source.

  6. Set up the Salesforce Case Data Destination:

    1. Enter the Destination Basics. Name this destination “Case Updates”.

      In the Destination Type section, select the option to make this a Regular Destination. This destination updates the Case record with data from the regular sections in the form.

      Destination Basics tab with "Use as a Regular Destination for a form" selected

    2. Use the %a DRELClosed Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms. reference to map the Case Fields to the unique IDs of the questions in the form.

      Case Fields tab that shows the "Contact Name" Salesforce field mapped to the data from the "ContactName" question in the form: %a[ContactName]

  7. Set up a Salesforce Standard, Custom, or Big Object Data Destination for the “Calibration List” Repeatable Destination.

    1. Enter the Destination Basics, and name this destination “Calibration Tests”.

      In the Destination Type section, select the option to make this a Repeatable Destination. Enter the unique identifier of the Repeatable Section that contains the calibration questions.

      Destination Basics tab with "Use as a Repeatable Destination for a Repeatable Section" selected

      Tip:You can find the section unique identifier here:

      Forms & Integrations > FormName > Pages & Questions

    2. Map the Custom Fields in the destination to the unique IDs of the questions in the form.

      In this example, the parent-child records and relationships already exist in Salesforce. This means that you can use the %a DREL reference to link the Calibration Test records with the parent Case record. You don’t need to create a parent-child relationship between the Regular and Repeatable Destinations.

      Example of a Salesforce Custom Object Data Destination with the "ID" question  mapped to the Salesforce "Case" field

  8. Associate the Data Destinations with the form.

    1. In your form, go to Destinations, and then select Add a Destination.

      Result: You can choose from a list of all destinations, or you can filter the list to display only Regular or Repeatable Destinations.

      List of "ALL" Data Destinations that shows Calibration Tests with an icon (a square with arrows) that indicates a Repeatable Destination. The Repeatable Destination also shows the linked Repeatable Section unique ID.

    2. Select the Regular Destination.

    3. Repeat steps 8a and 8b for the Repeatable Destination.

      Note:You can’t attach documents to a Repeatable Destination. This prevents duplication of the same document across multiple records.

    4. After you’ve tested the form, Save and deploy it.

  9. In the TrueContext Mobile App, open the form, enter data, and submit the form.

    Result: The Data Destinations update the Salesforce Case and Calibration List records. Go to your Salesforce Org and check the updated records.

Related topics

Want to know more? The following topics provide detailed information about the features and functionality used in this recipe.