Display an image in Salesforce fields using Salesforce Flows
This article demonstrates how to display the latest image uploaded onto a SharinPix Album in Salesforce fields.
This can be performed by:
Adding an image to a Rich Text field using a Salesforce Flow and the SharinPix Image Sync feature.
Using a Salesforce Flow along with the SharinPix Image Sync feature to display an image in a Formula field.
Note:
In both cases, the SharinPix Image Sync feature should be enabled for the object you intend to use.
You can refer to the following article for detailed information about how to set up the Image Sync for an object:
Information:
For this demo, we will use the Account object since the SharinPix package includes an Image Sync setup for the Account object by default.
However, you should make sure that the **Enable Image Sync parameter ** is checked on the SharinPix Album component added to the Account record page.
Using a Flow to add an image to a Rich Text field
Creation of the Rich Text field
Before creating the Flow, we need to create a field that will display the image. Therefore, go to the Account object and create a new field as follows:
Data type: Text Area (Rich)
Field Label: Image
Creation of the Flow
Once the Image Sync is enabled and the Rich Text field is created, go ahead and create a new Salesforce Flow as follows:
Go to Setup. In the Quick Find Box, type Flows.
Under Process Automation , select Flows.
Click on the New Flow button.
Select the option Record-Triggered Flow , and click on the **Create **button.

After clicking on Create , the _Configure Start _modal will be displayed. Fill in the modal as indicated below:
Select Object : SharinPix Image
Configure Trigger : A record is created
For the Set Entry Conditions , select All Conditions Are Met (AND) and fill in the details as follows:
Field: sharinpix__Account__c
Operator: IsNull
**Value: **Select {!$GlobalConstant.False}
Optimize the Flow for : Actions and Related Records
Click on Done to save the configurations.

Next, add an Update Triggering Record element.


On the _Update Triggering Record _modal, enter the following information:
Label**: **Update Parent Account Record
How to Find Records to Update and Set Their Values: Specify conditions to identify records, and set fields individually
**Object: **Account
In the Field Account Records section:
Condition Requirements to Update Record: All Conditions Are Met (AND)
**Field: **Id
Operator: Equals
**Value: **{!$Record.sharinpix__Account__c}
In the** Set Field Values for the Account Records **section:
For the Field , select the Image field available on the parent Account record.
For the Value , click on New Resource _ _ and enter the following information
**Resource Type: **Variable
API Name**: **richTextValue
**Description: **Optional
**Default Value: **
<img src={!$Record.sharinpix__ImageURLThumbnail__c}/>

Save the newly-created resource.
Click on **Done **to save the formula and the _Update Triggering Record _element.

Save the Flow and activate it.
Demo
To test this new implementation:
Go to an Account record
Upload an image to the SharinPix album
Check if the field, **Image **displays the image accordingly

Using Flow to display an image in a Formula field
This section covers the following:
Creation of a Salesforce field to store the image URL
Creation of a Formula field to display the image
Creation of a Flow to update the URL field whenever an image is uploaded
Creation of the Salesforce fields
Create the fields as follows:
A field of type **URL **to store the image URL generated:
Data Type: URL
Field Label: First Image URL
A **Formula field that will use the image URL stored in the field created above (that is First Image URL) **to display the image. For the formula field:
Date Type: Formula
Field Label: First Image
Formula Return Type: Text
Formula:
IF( ISBLANK( First_Image_URL ), "Image Not Found", IMAGE( First_Image_URL, "" ) )
Creation of the Flow
Once the fields created, go ahead and create a new Salesforce Flow as follows:
Go to Setup. In the Quick Find Box, type Flows.
Under Process Automation , select Flows.
Click on the New Flow button.
Select the option Record-Triggered Flow , and click on the **Create **button

After clicking on Create , the _Configure Start _modal will be displayed. Fill in the modal as indicated below:
Select Object : SharinPix Image
Configure Trigger : A record is created
For the Set Entry Conditions , select All Conditions Are Met (AND) and fill in the details as follows:
Field: sharinpix__Account__c
Operator: IsNull
**Value: **Select {!$GlobalConstant.False}
Optimize the Flow for : Actions and Related Records
Click on Done to save the configurations.

Next, add an Update Triggering Record element.


On the _Update Triggering Record _modal, enter the following information:
Label**: **Update Parent Account Record
How to Find Records to Update and Set Their Values: Specify conditions to identify records, and set fields individually
**Object: **Account
In the **Field Account Records **section:
Condition Requirements to Update Record: All Conditions Are Met (AND)
**Field: **Id
Operator: Equals
**Value: **{!$Record.sharinpix__Account__c}
In the** Set Field Values for the Account Records **section:
For the Field , select the First Image URL field available on the parent Account record.
For the Value , select {!$Record.sharinpix__ImageURLThumbnail__c}

Click on **Done **to save the formula and the _Update Triggering Record _element.
Save and activate the Flow.
Demo
To test this new implementation:
Go to an Account record
Upload an image to the SharinPix album
Check if the Image** ** and **First Image URL **fields have been populated correctly as demonstrated below:

Tip:
The methods mentioned above have a limitation, they cannot be used to display multiple images in one field.
However, SharinPix provides a component (the **SharinPix To Rich Text Area **component) that perform the same process and which can be used to add multiple images in one field.
The SharinPix To Rich Text Area component allows users to select and send one or more images from a SharinPix album to a **Rich Text **field. This method is easier to configure and provides more flexibility.
For more information about this component, please refer to the following article:
DEPRECATED: Using Process Builder to add an image to a Rich Text field
Note:
This section is deprecated and is only used for Process Builder maintenance.
Create the Process Builder
Follow the steps below to create the Process Builder:
Go to Setup. In the Quick Find Box, type Process Builder
Under Process Automation , select Process Builder
Click on New
For the newly-created Process Builder:
For the field, **Process Name **enter Add Image to Rich Text Field on Account
Enter a description for the process. (This step is optional)
For the field, The process starts when select A record changes
Click Save
Once on the Process Builder editor:
Click on Add Object
For the field Object , select** **SharinPix Image
For the field Start the process , choose when a record is created
Click on Save
Click on Add Criteria
For the field Criteria Name , enter No Criteria
For the field Criteria for Executing Actions , choose No criteria—just execute the actions!
Click on Save
Click on Add Action
For the **Action Type **field, choose Update Records
For the Action Name , enter** **Update Account Record
For the Record Type , select Select a record related to the sharinpix__SharinPixImage__c. Then from the dropdown menu, select Account
Click on Choose

Leave **Criteria for Updating Records **on No criteria—just update the records!
Inside the **Set new field values for the records you update **section:
For the Field , select the Rich Text field created previously, that is Image
For the Type , select Formula
For the Value , click on Build a formula
Inside the formula builder, use the following formula:
" <img src="" & [sharinpix__SharinPixImage__c].sharinpix__ImageURLThumbnail__c & "" />"

The above formula makes use of the field **[sharinpix__SharinPixImage__c].sharinpix__ImageURLThumbnail__c **which stores the image's URL in a thumbnail format on the SharinPix Image object.
Click on Use this Formula
Click on **Save **when done
You can now activate the Process Builder.
DEPRECATED: Using Process Builder to display an image in a Formula field
Note:
This section is deprecated and is only used for Process Builder maintenance.
Create the Process Builder
Follow the steps below to create the Process Builder:
Go to Setup. In the Quick Find Box, type Process Builder
Under Process Automation , select Process Builder
Click on New
For the newly-created Process Builder:
For the field, **Process Name **enter Add an Image to Field on Account
Enter a description for the process. (This step is optional)
For the field, The process starts when select A record changes
Click Save
Once on the Process Builder editor:
Click on Add Object
For the field Object , select** **SharinPix Image
For the field Start the process , choose when a record is created
Click on Save
Click on Add Criteria
For the field Criteria Name , enter No Criteria
For the field Criteria for Executing Actions , choose No criteria—just execute the actions!
Click on Save
Click on Add Action
For the **Action Type **field, choose Update Records
For the Action Name , enter** **Update Account Record
For the Record Type , select Select a record related to the sharinpix__SharinPixImage__c. Then from the dropdown menu, select Account
Click on Choose

Leave **Criteria for Updating Records **on No criteria—just update the records!
Inside the **Set new field values for the records you update **section:
For the Field , select the URL field created previously, that is First Image URL
For the Type , select Field Reference
For the Value , choose Image URL Thumbnail
Click **Save **when done
You can now activate the Process Builder.
Last updated

