Duplicate SharinPix Images Using a Flow (Admin-Oriented)
Overview
The DuplicateImagesAutomation
Invocable Apex method allows users to duplicate specific images from one SharinPix album to another, with the option to include associated tags. This is ideal for use cases where only a subset of images (e.g., those flagged or selected in a custom UI) needs to be copied across records.
This invocable method is designed for use in Salesforce Flows and supports image transfer between any two records with linked SharinPix albums (e.g., from Case to another Case, Site to Project, etc.).
This article covers the following:
Prerequisites
Before configuring this automation, ensure the following:
- You have the latest SharinPix Managed Package installed.
Input Parameters
Below are the inputs required when using the DuplicateImagesAutomation
invocable method in a Salesforce Flow. These must be populated for the image duplication to succeed.
Parameter | Description |
---|---|
imageIds | A list of SharinPix Image Public IDs that should be duplicated. Example: ["id1", "id2"] . (Required)
|
destinationAlbumId | The ID of the destination record, where the duplicated images should be stored. This record must be linked to a SharinPix album. (Required) |
tags | Boolean indicating whether to duplicate tags along with the images. (Optional) |
Flow Setup
This example is based on a Work Order to Work Order Line Item scenario, where specific images from a Work Order’s SharinPix album are duplicated into the album of a related Work Order Line Item.
Step 1: Select Images from Source Album
Use a Screen Element with the SharinPix Album (LWC)
component.
-
Label:
Select Images to copy
- Users select images from the Work Order's SharinPix album
- In the
AlbumId
field, create a new resource of type Variable and Data Type Text. For the API Name, please type in " recordId "
Step 2: Fetch Related Work Order Line Items
Add a Get Records element to retrieve WOLIs related to the current Work Order.
- Object: Work Order Line Item
-
Filter:
WorkOrderId
equalsSource_Album.RecordId
(or Work Order ID contextually) - Store All Records, with All Fields
Step 3: Choose Destination WOLIs
Add another Screen Element using the Data Table component.
-
Label:
Choose Work Order Line Item on which to paste duplicated images
- Source Collection: The WOLIs from Step 2
- Allow selection of one or multiple WOLIs (as needed)
- Configure the rows and columns of the data table as per your use case. In this case, we will show
Work Order Line Item Number
as the column.
Step 4: Execute Duplication
Add an Apex Action calling sharinpix__DuplicateImagesAutomation
.
-
Label:
Duplicate Selected Images
-
List of Image Ids: Value from Screen 1 (selected image IDs -
{!Source_Album.selectedImageIds}
) - Destination Album ID: Selected WOLI(s) from the Data Table
-
Duplicate Tags:
True
(optional)
Demo: Work Order to WOLI Flow Example
On the Word Order record 00000001
, we have two related Work Order Line Item. Images are selected, and the ' next ' button is pressed.
The next screen shows the data table displaying all the related WOLIs by their WOLI Number. Choose the WOLI record(s) on which the previously selected images will be duplicated and click next. The images have been successfully duplicated.
The images and tags appear on the previously selected WOLI record's album.
0 Comments
Add your comment