Importing Images from Salesforce Files to a Form in Salesforce Lightning
Introduction:
In Salesforce Lightning, you can seamlessly integrate images stored in Salesforce files into your forms by following a few straightforward steps. The procedure below outlines the process from creating a custom field to adding the image tag to your form in the Designer.
Procedure:
Step 1: Add a Custom Text Area (Long) Field
- Navigate to the object from which you want to generate the output.
- In the object’s “Fields & Relationships,” click on “New.”
- Select the “Text Area (Long)” data type and click “Next.”
- Enter a name for the new custom field and click “Next.”
- Click “Next” to establish field-level security, then click “Save.”
Step 2: Create a URL for the Image File
- In “Files,” locate the image file you want to add to the form.
- Note: If the file is not already present, you can upload it to Salesforce.
- Click the arrow next to the record line and select “Public Link.”
- In the “Public Link Sharing” page, click “Create Link.” The “Create unrestricted public link?” page is displayed.
- Click “Create.” The “Public Link Sharing” page reappears.
Step 3: Add the Link to the Custom Field
- In the “Public Link Sharing” page, click “Copy Link.”
- Open a new browser tab, paste the link, and view the displayed image.
- Right-click the image and choose “Copy image address.”
- Go to the object to which you added the custom field.
- In the “Details” tab, scroll to the new custom field and paste the copied address.
Step 4: Add the Image Custom Field to the Data Model
- Open the data model of the form to which you want to add the image.
- Add the new custom field to the data model as an applicative tag (interactive is not supported). Refer to “Defining a Data Model.”
Step 5: Add the Image Tag to the Form in the Designer
- Open the form in the Designer.
- Insert the image field tag as a picture.