This lesson will cover the following topics:

01 Getting Started

This tutorial will show you how to use some of the image actions available for Titan Files. The tutorial will demonstrate when a PNG file is added to the Salesforce accounts object, a watermark will be added to the image and the image will be converted into a JPG file.

02 Watermark and Conversion Flows

1. Navigate to Process Automation Flows in Salesforce and click New Flow.

create a new flow

2. Select Record-Triggered Flow and click Create.

choose record-triggered flow

3. Configure the following:

  • Object - TFile
  • First condition - The Parent Object equals Account. This can be any object that the image is uploaded to.
  • Second condition - The File Extension equals PNG.

Configure files flow

4. Save and Label your flow.

5. Click the + icon.

add a new node

6. Search for the File Action node and select it.

add file action node

7. Configure the following:

  • Label - Watermark Convert
  • Parent Object - Account

8. Select the Settings icon in the Flow window.

New apex action screen

9. Click the Files menu item under Variables, and add two new Files Variables: output_watermark and output_conversion. These variables will be used to hold the outputs for each step. Click Apply.

configuring two new variables

10. In the Titan Flow window, click the Any + icon and select Image Watermark as the node. Click Next.

choose image conversion node

11. Select the file variable in the File In dropdown.

12. Configure the text and formatting to be applied to your image.

13. Select the output_watermark variable in the File Out dropdown. Click Next.

file in and file out configuration

14. Add a tag and click Insert.

15. Click the Watermark + icon and choose Image Conversion as the node. Click Next.

choose image conversion node

16. Select the output_watermark variable in the File In dropdown. This means that the watermarked image will be converted.

17. Select the JPG format in the Out Type dropdown.

18. Select the output_conversion variable in the File Out dropdown. Click Next.

file in and fileout

19. Add a tag and click Insert.

Currently, PNG images will have a watermark added to them and then they will be converted to JPG files. Next, we will configure Salesforce actions to run on these images.

screenshot of the current flow

03 Salesforce Action Flow

First, we will create an action to upload the watermarked and converted file to the same Salesforce object that the file was originally uploaded to.

1. Click the Convert + icon and choose Salesforce Action as the node. Click Next.

Adding salesforce action node

2. Click Salesforce Integration.

Salesforce integration button

3. Select the Push tab and click Create New.

Create new salesforce push

4. In the Object Settings tab configure; content version as the Salesforce object, create as the action, and create files as the description.

object settings tab for the first push

5. In the Mapping tab, map the following and then click Apply.

  • Version data - GV/output_conversion
  • First Publish Location ID - GV/parentRecordId

Mapping tab for first push

Next, we will configure a delete push that will delete the original file.

1. Click Create New.

Click create new push

2. In the Object Settings tab configure; content document as the Salesforce object, delete as the action, and create files as the description.

Object settings tab for the second push

3. In the Conditions tab, configure that the Content Document ID equals the contentDocumentId field. Click Apply and Close.

conditions tab for the second push

4. Using the dropdown to select both Salesforce pushes. Ensure you select the pushes in the order they should run i.e. save the watermarked and converted file first then delete the original. Click Next.

screenshot showing the selected pushes

5. Add a tag and click Insert.

6. Click Done in the Apex configuration window.

7. Save the updated flow and Activate.

The current configuration will be triggered when a PNG file is added to an account. The image will be watermarked and converted to a JPG, after this has been completed the original file will be deleted.

04 Got Feedback?