SharinPix DocumentationMain Documentation SharinPix features - main integrationDisplay Images in Service Report (Salesforce Field Service / FSL)

Display Images in Service Report (Salesforce Field Service / FSL)

Information:

Salesforce Field Service (SFS) was formerly known as Field Service Lightning (FSL).

This article demonstrates how to display a SharinPix Image record in a Service Report. This can be performed by either storing the image in a SharinPix Image field of type Formula or Rich Text.

Note:

In order to display images in a Service Report, SharinPix Image Sync should be set up for the object you intend to use. 

For this demo, we will be using the Work Order object. Therefore, Image Sync should be enabled for this object. You should also make sure that the option Enable Image Sync is checked for the SharinPix Album component added to the Work Order object.

You can refer to the following article for more details on how to set up Image Sync for an object:

Setup SharinPix Image Sync

Using Formula fields to display images in a Service Report

In this section, we will:

  1. Make use of Formula fields on the SharinPix Image object to store the image
  2. Add the Formula field to the required Service Report Template

Use of the Formula field

The SharinPix package already includes some Formula fields that store images with different dimensions on the SharinPix Image object. These fields are:

  • Image Original: corresponds to the original size
  • Image Mini: corresponds to a size of 100 x 100 pixels
  • Image Thumbnail: corresponds to a size of 200 x 200 pixels
  • Image Full: corresponds to a size of 1920 x 1280 pixels

You can either use the above Formula fields in your Service Report template or use custom Formula fields to store the images. The custom Formula fields should be in the following format:

IMAGE(<Image_URL>, <Alternate_Text>, Height, Width)

Tips:

  • The height and width in the Formula field are optional.
  • For better results, you can use the SharinPix Transformation feature to customize the image size. SharinPix Transformation allows automatic resizing of your images. 

Using this feature, you can easily play with the height and width until the desired image display is obtained. You can find more information on SharinPix Transformation here: SharinPix Transformation - get your images automatically resized!


The best practices when it comes to the usage of the SharinPix Transformation are:

  • Firstly, to add a SharinPix Transformation on a custom URL field. For example a custom field named PDF_Image_version_URL__c.
  • Then, make the transformation fit your needs in term of resolution.
  • Finally, use the transformation URL field in a Formula field without setting the formula's height and width as demonstrated below:

IF (ISBLANK(PDF_Image_version_URL__c), "", IMAGE(PDF_Image_version_URL__c, ""))

Note: The IF(ISBLANK()) part is used as an alternate in cases where the URL field (PDF_Image_version_URL__c in this scenario) is blank. This will ensure that no broken image links are displayed.

Addition of the Formula field to the Service Report template

Now that your Formula field is ready, go ahead and add the SharinPix Images related list on the Service Report Template by following the steps below:

  • From Setup, search and select Service Report Template
  • Click on the Edit link, next to the required template
  • From the left menu, click on Work Order
  • Drag and drop the List element onto the template
  • On the List Properties modal:
    • Enter SharinPix Images as the Title
    • Select SharinPix Images as the Object
    • From the Available Fields list, search and add the rquired Formula field. For example, Image Thumbnail
  • Click OK when done
  • Then, click on Save


Your Service Report template is now ready!

Using Rich Text fields to display images in a Service Report

Creation of the Rich Text field

Before creating the Process Builder, we need to create a field that will display the image. To do so, follow the steps below:

  • Go on Setup, then click on Object Manager
  • Search and select SharinPix Image
  • Next, create a Rich Text field as follows:
    • Data type: Text Area (Rich)
    • Field Label: Display Image

Creation of the Process Builder

Now that Image Sync has been set up and our new Rich Text field created, we can go ahead and create the Process Builder.

To do so, follow the steps below:

  • 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:
    1. For the field, Process Name enter Add Image to Rich Text Field on SharinPix Image
    2. Enter a description for the process. (This step is optional)
    3. For the field, The process starts when select A record changes
    4. Click Save

Once on the Process Builder editor:

  • Click on Add Object
    1. For the field Object, select SharinPix Image
    2. For the field Start the process, choose when a record is created or edited
    3. Click on Save
  • Click on Add Criteria
    1. For the field Criteria Name, enter No Criteria
    2. For the field Criteria for Executing Actions, choose No criteria—just execute the actions!
    3. Click on Save
  • Click on Add Action
    1. For the Action Type field, choose Update Records
    2. For the Action Name, enter Update SharinPix Image Record
    3. For the Record Type, select Select the sharinpix__SharinPixImage__c record that started your process
    4. 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:
  1. For the Field, select the Rich Text field created previously, that is Display Image
  2. For the Type, select Formula
  3. For the Value, click on Build a formula
  4. 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.

    5. Click on Use this Formula

  • Click on Save when done

You can now activate the Process Builder.

Addition of the Rich Text field to the Service Report template

Now that your Process Builder is ready, go ahead and add the SharinPix Images related list on the Service Report Template by following the steps below:

  • From Setup, search and select Service Report Template
  • Click on the Edit link, next to the required template
  • From the left menu, click on Work Order
  • Drag and drop the List element onto the template
  • On the List Properties modal:
    • Enter SharinPix Images as the Title
    • Select SharinPix Images as the Object
    • From the Available Fields list, search and add the Formula field labeled as Display Image Formula
  • Click OK when done
  • Then, click on Save


Your Service Report template is now ready!

0 Comments

Add your comment

E-Mail me when someone replies to this comment