Automatic Album Token Generation using a Flow (Admin-Oriented)

Overview

This article explains how the invocable Apex GenerateAlbumTokenAutomation generates an online token to access a SharinPix Album through a Salesforce Flow.

It covers the following:

  1. Flow Configuration Guide

circle-exclamation

Input Parameters

Below are the inputs required when using the GenerateAlbumTokenAutomation invocable method in a Salesforce Flow. These parameters must be provided to successfully generate an album token.

Parameter
Description
Required/Optional

recordId

The Salesforce Record ID (e.g. Work Order ID) to generate Album token for.

Required

permissionId

Name or ID of the SharinPix Permission object (of type Album) to be used for token generation. If no SharinPix Permission is specified, the user will receive an album token with basic abilities.

Optional

expiry

Number of days after which the token will expire.

Optional

Flow Configuration Guide

The following flow setup uses a Record-Triggered Flow to automatically generate a SharinPix token when a record is created or updated. The Work Order object is used here as an example, but you can apply the same automation to any Salesforce standard or custom object, depending on where you want to generate the token.

Step 1: Prepare Custom Field To Store Token

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

  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., SharinPix Album Token) and set the length to the maximum value (131,072 characters).

  5. Save the field.

This field will store the full token 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

Status Field Equals to In Progress

Optimize the Flow for

Actions and Related Records

Add Asynchronous Path

On

*Please note that the Object Setting can be configured as desired.

Step 3: Add the Action to Generate the Album Token

  1. For this example, we will create a SharinPix Permission of type Album with the following abilities:

  1. On your flow, add an Action element

  2. Search for Sharinpix__GenerateAlbumTokenAutomation

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

Field
Example Value

Record ID

Triggering WorkOrder > Work Order ID

Expiry in Days

10

SharinPix Permission Name or ID

Album Permission*

*Note that if no SharinPix Permission is specified, the user will receive an album token with basic abilities.

circle-exclamation

Step 4: Add Update Element

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

  1. Add an Update element

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

  3. For this example, we will not add any filter conditions.

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

Field
Value

SharinPix_Album_Token__c

Outputs from sharinpix__GenerateAlbumTokenAutomation.SharinPix_Album_Token__c

Step 5: Save and Activate the Flow

Save the Flow and click Activate.

Demo

To test the Flow, create or go to a Work Order record and set the Status field to In Progress.

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

circle-info

To use the generated token to open a SharinPix Album in online mode, you can refer to this article: SharinPix Mobile App: Online Mode.

The image below illustrates the SharinPix Album configured with the permissions outlined in the Album Permission above.

Last updated

Was this helpful?