Loading

Import images in a rich text field with Data Loader

Fecha de publicación: Oct 13, 2022
Descripción

The Data Loader can be used to import images associated with rich text fields in your organization. 


 

Solución


To insert rich text field content 

 

1. To get started, we need to prepare an import file to upload the images into Documents. Please review Mass import Documents into Salesforce .  

Note: You will need the Salesforce IDs (Or External IDs) of each record on the object you are importing the images into eventually. To make this process easier when preparing your document import file include this column into your import file ensuring that the IDs of the records match to the documents that will eventually be imported onto them (We'll call this column RecordID).
 

2. Next we need to take the success file from the document import and use it to construct the HTML code for the rich text field.
 

3. Add a new column to the beginning of the success file with a column header called link. You can use the following links as examples:

  • For externally available images paste and copy this link all the way down the file: <img src ="https://c.naX.content.force.com/servlet/servlet.ImageServer?id={ImageID}&oid={OrgID}">
  • For internally available images paste and copy this link all the way down the file: <img src ="https://c.naX.content.force.com/servlet/servlet.FileDownload?file={ImageID}">

4. Find and Replace naX with the instance of the server the images are on and find and replace {OrgID} with the ID of the Organization. Please review Find your Salesforce Organization ID for more.

5. Insert a new column into excel in front of the link column with the header matching the name of the Rich Text field and ensure the column labeled 'ID' is column C.
 

6. Use the following formula to populate the ImageID: =SUBSTITUTE(B2,"{ImageID}",C2)
 

7. Right click on column a and copy. Right click again and then paste special - Values. Save the file.
 

8. Open the Data loader (Login to Data Loader).

9. Select the function as Upsert.

10. Select the Object by checking "Show all objects".

11. Select the object the rich text field is on| Map the ID of the records and the rich text field column| Select the directory where your success and error files will be saved and then click Finish and OK.

12. The rich text fields will be populated with your images in Salesforce.



See also:
Insert, Update, or Delete Data Using Data Loader
Install Data Loader on Windows

Número del artículo de conocimiento

000383208

 
Cargando
Salesforce Help | Article