Create and Update Related Salesforce Records with SharinPix Forms

Overview

A SharinPix Form can be configured to synchronize Salesforce related (child) records with the parent record linked to the Form Response. In other words, SharinPix Forms can be used to display, create, and update related (child) records. 

For example, when a form is launched from an Account, that Account is automatically set as the parent record of the Form Response. By using Repeated Sections, multiple related Contact records can be created or updated directly within the form. When the form is reopened, those Contacts can be retrieved, and their existing field values can be pre-populated in the form for review or updates.

 

This article consists of:

Prerequisite

Before using this feature, ensure:

  • Ensure that you are using the most recent SharinPix Package Version. Follow this document to upgrade the SharinPix package

  • Admins or power users who need to configure or set up form features should be assigned the permission set SharinPix Forms Admin Permission.
    End users who only need to use the forms should be assigned the permission set SharinPix Forms Users Permission.

Configuring Form Repeated sections to pull child records

To pull Salesforce related records into a SharinPix Form, the Pull data from a Salesforce record section of the Repeated Section element must be configured.

  1. Object API Name - [Mandatory] The API name of the child object.
  2. Lookup API Name - [Mandatory] The API name of the lookup field on the child object that links to the Form Response parent record.
  3. Lookup value field API Name - [Required only if you want to create child records not parent to the Form Response] The API name of the field where the Form Response parent record Id is stored. This is used when child records are created for a different object, rather than directly for the Form Response parent record. (See )

For the third option Lookup value field API Name, this option can be used for example:
SharinPix Form in launched from an opportunity object, here the Form Response Parent object is Opportunity. On the opportunity record, you can store a salesforce record Id for any object (a field on the opportunity record with API name MyObjectRecordId__c).

The Lookup value field API Name should be set to MyObjectRecordId__c. Lets say we still want to create Contacts for an Account, then the particular record Id for the Account should be stored in the MyObjectRecordId__c field. This configuration will allow you to create child records for a specific parent object not directly related to the Form Response.

After the setup for retrieving the child records to be filled in the form is completed, the fields to be pulled must be configured. Each question within the repeated section can be used to represent a specific Salesforce field from the child object.

Question - A dropdown of all form questions API names in this specific section

Salesforce Field API Name - The Field API Name of the child object of which to pull the value

 

Each question in the section will represent one Salesforce field in the child record being pulled. Example if the Form Section contains:

Batch Number:

  • Form Field API Name - batch_number
  • Salesforce Field API Name - Batch_Number__c

Compliance Status:

  • Form Field API Name - compliance_status
  • Salesforce Field API Name - Compliance_Status__c

Emergency Exists Functional:

  • Form Field API Name - emergency_exits_functional
  • Salesforce Field API Name - Emergency_Exits_Functional__c

External Id:

  • Form Field API Name - external_id
  • Salesforce Field API Name - External_Id__c

Note

Two steps are required:

  1. Create a Salesforce custom External Id text field for the child object that you want to retrieve and upsert.
  2. Create a Question of type text to hold the External Id value of the child record (you can disable the text input to prevent editing).

This is because the external id field API name is needed to update the records that will be pulled into the form and represented as sections.

If you have no child records to be pulled but want to create them directly from the form, when a response is submitted, a UUID will be auto-generated and will populate the external id field on salesforce. You do not need to provide an external id value within the form, leave the question as disabled and empty.

Beware that if the Form Question that holds the External Id value is set to hidden and the form configuration has the checkbox "Include hidden fields in response" set to false, this will not send the external id value to Salesforce when the form is submitted hence existing child records will not be updated and a new child record will be created everytime the form is submitted.

All Inspection child records for the selected Account are pulled by this configuration. For example, if the Account contains 10 related Inspection records, the SharinPix Form is opened with 10 repeated sections, each one representing a single child record.

To synchronize Salesforce records with SharinPix Form repeated sections, the following must be done:

  • A question must be created inside the repeated section to store the record’s external ID (as shown in the previous image above).
  • The Salesforce API name of the external ID field must be specified in the record pull mappings.

In the External field mapping section, the field that represents the external ID (from the mapped fields) must be selected. This is then used to upsert the child records.

Configuring Form Section or Repeated sections to push child records

Once we have configured the form to pull related child records to represent in repeated sections in our form, we need to specify which fields we want to populate in the record. You can follow the documentation for creation of child records from SharinPix Forms.

Note

It is important to specify the External Id field in the push configuration for the existing child records to be able to update. If not specifed, new child records will be created.

Once the form configuration is complete, each time a Form Response is submitted, it will check the related child Inspection records. For each Inspection record (represented as a section), it will first check whether a corresponding record already exists by comparing the defined External ID field. If no matching record is found, a new Inspection record will be created. If a matching record already exists, the existing Inspection record will be updated with the data from the submitted Form Response.

Please note that there is no limitation on the number of child records that can be retrieved in a form. However, retrieving a large number of records may result in the form URL becoming too long. This is not only influenced by the number of records retrieved, but also by the number of Salesforce fields pulled for each record.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.