Automatic Form URL Generation using Flow (Admin-Oriented)

Overview

The GenerateFormUrlAutomation class is an Invocable Apex utility that allows Salesforce Admins to automatically generate secure SharinPix Form URLs directly from Flows

The generated URL opens a SharinPix Form on the SharinPix Mobile App for users to fill out. 


This article covers the following:

  1. GenerateFormUrlAutomation's Input Parameters
  2. Flow Configuration Guide
  3. Demo

Prerequisites

Before configuring this automation, ensure the following:

  • You have the latest SharinPix Package installed. This feature requires version 1.346 or higher. You can follow this guide to upgrade your SharinPix Managed Package to the newest version.
  • A form template has been created using the SharinPix Form Template Editor.

Input Parameters

Below are the inputs required when using the GenerateFormUrlAutomation invocable method in a Salesforce Flow. These parameters must be provided to successfully generate a SharinPix Form URL.

Parameter Description
recordId The Salesforce Record ID (e.g. Work Order ID) to which the form url will be associated. (Required)
formTemplateId The ID or Name of the SharinPix Form Template for which you want to generate the url. (Required)
nameFieldApiName API name of a field on the record (e.g. WorkOrderNumber) to be used as the job name in the SharinPix Form.
expiry Number of days after which the url will expire. 

Flow Configuration Guide

The following flow setup uses a Record-Triggered Flow to automatically generate a SharinPix Form Url when a Work Order is created or updated.

Step 1: Prepare Custom Field To Store URL

A field is needed on the Work Order object to store the generated URL. To do so, create a Text Area (Long) field to store the entire URL.

  1. Go to Setup > Object Manager > Work Order.

  2. Click on Fields & Relationships > New.

  3. Select Text Area (Long) as the field type.

  4. Name the field (e.g., Form Url) and set the length to the default value (32,768 characters).

  5. Save the field.

This field will store the full Form URL returned by the flow.

Step 2: Configure a Record-Triggered Flow

  1. Go to Setup > Flows > Click New Flow 

  2. Choose Start From Scratch and click Next

  3. Choose Record-Triggered Flow and click Create

  4. Set the following values:

Setting Value
Object Work Order
Trigger A record is created or updated
Set Entry Conditions None
Optimize the Flow for Actions and Related Records

Step 3: Add the Action to Generate the Form Token

  1. Add an Action element

  2. Search for Sharinpix__GenerateFormUrlAutomation

  3. On the Action modal for Sharinpix__GenerateFormUrlAutomation, populate the fields as indicated below:

Field Example Value
Form Template ID  Fire Safety Inspection 
Record ID  Triggering WorkOrder > Work Order ID
Expiry in Days 15
Name Field API Name  WorkOrderNumber

Warning: 

  • If the expiry value is not specified, the token will default to 30 days. If the token should not expire, the expiry value should be set to zero (0). This field only accepts whole numbers; decimal values are not supported and will result in an error.
  • Ensure the specified template exists in your Salesforce org and that you have entered the correct name or ID.

Step 4: Add Update Element

This step is used to store the url generated by the Apex action into the custom field FormUrl__c you created on the Work Order.

  1. Add an Update element

  2. Select Use the Work Order record that triggered the flow

  3. Do not add any filter conditions.

  4. In the Set Field Values for the Work Order Record section, populate it as indicated below:

Field Value
FormUrl__c Outputs from sharinpix__GenerateFormTokenAutomation.formUrl

Step 5: Save and Activate the Flow

Save the Flow and click Activate.

Step 6: Find the SharinPix Form URL

To test the flow, create or update a Work Order record.

After the flow runs, the generated SharinPix Form URL will be stored in the FormUrl__c  field of the Work Order. You can view it directly from the record detail page to confirm that the token was generated successfully.

Demo 

The diagram below illustrates the interaction flow when a user clicks the form URL from a Work Order record, launching the SharinPix Form directly in the SharinPix Mobile App.

0 Comments

Add your comment

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