Using The IMAGE() Function

1.25 | 2/21/2023
Post-Installation, Document Generation, Image Function,

Access Data Outside the Object’s Scope

Adding images to your documents can be made easier by using our IMAGE function. However, you’ll need to prepare your images in advance so that Mambo Merge can locate and retrieve them properly. Here are the steps to get started.

Upload Images

You’ll need to upload images to your FILES direction or library in order to obtain their File IDs. These IDs will be used to call out each image when the function is used and a template is merged.

Proceed to your FILES tab and choose Upload Files.

Select all the images to upload and click Open.

Note: Make sure to re-size images before uploading them to ensure they fit within the desired template.

Once all files have been uploaded continue by pressing Done.

Each image upload will now appear within your FILES tab.

Note: We recommend using Libraries to keep all your images organized in one central location for accessing, revising, and maintaining in the future.

Identify Each File ID

Now we’re going to identify one of the images uploaded by heading over to it, clicking on its Down-Arrow, and selecting View File Details.

Note: Repeat this process for each image uploaded.

This next page will contain a ULR on the top, following the ContentDocument/ section you will find 15-18 alphanumeric characters. Copy and save this as it will be the unique identifier used by our IMAGE function to locate this image file.


Note: Each file has its own unique file ID. Uploading a copy of the same file will create a new file ID. In order to preserve the file ID for an existing file you must replace it using the Upload New Version option.

Create A Custom Text Field

Next will create a custom text field to house the file ID assigned by Salesforce for each image uploaded.

Note: You’ll need to map each file ID to its corresponding record when the time comes.

Access the object page containing the component that will utilize the IMAGE function and click its Gear icon. From the dropdown list, select Edit Object.

Note: For this example, we will be creating a new field within the Opportunities object page.

Within the Object Manager, click on Fields & Relationships and then New to begin creating a text field.

Select Text for the field type and click Next.

Provide a Field Label and Length then proceed to click Next.

Note: The Field Name is automatically generated based on the Field Label entered. Description and Help Text are optional to summarize the purpose of the field. We called our field Opportunity Image and gave it a text field length of 40.

Establish Field-Level Security by identifying which users will have access to this new field. Proceed by clicking Next.

Define which Page Layouts will be allowed to use this field and complete by clicking on Save.

Once saved the Opportunity Image text field will now be available for use.

Insert File ID To Custom Field

Now you can add the File ID to the new custom field within each record page. For this example will edit one record to test. For some projects, you will use a tool to help simplify this process.

Proceed to a record and select Edit to update this new field with the file ID.

Note: For this example, we are now going to go back to our Opportunities tab and choose an opportunity to Edit.

Make sure to paste only the file ID saved previously without any additional characters. Using the Paste as plain text (Ctrl+Shift+V)

Once pasted double-check to ensure no additional characters were added and click on Save to update the record.

Build The Template

By populating this new field, we can now use the merge function and field syntax within our template to verify that the linked image will display correctly when our document is merged.

Note: We are using the Opportunities object for this example and have an opportunity record opened with an instance of Mambo Merge already installed.

Start by clicking on the Down-Arrow and Selecting Template Builder.

Choose the correct Object and Field to generate the Merge Field Syntax for our new field. Then copy and save it for later use.

Note: For this example, our object is Opportunity and the field name is Opportunity Image. The merge field syntax needed to add within our merge function is {{Opportunity_Image__c}}.

Build The Template

Now we can proceed to build a template as this function calls the merge field which has the File ID stored.

We start by opening up a new word doc and inserting the following merge syntax {{IMAGE(Opportunity_Image__c)}}.

Note: Must be using the PRO edition to use this function.

Download a copy and save it to your computer to drag the template to the component in order to test and generate the file with the image called.

A File Generated Successfully notification will appear on the top once the file is complete.

Upon opening the file, the image called by the file ID stored within the custom text field will now be shown within the document.

Note: If the image does not appear go back and make sure the copied File ID does not include any additional characters.

MERGING IMAGES ONE FILE AT A TIME

The process is pretty straightforward however some projects will require the use of additional tools to help upload documents, extract file IDs, create custom fields, and insert the IDs within each field all at once. Don’t worry we’ve got you covered, contact our team for assistance.