33
Word Templates
Automatically Resize Images
You may include an option within the merge field to specify a desired height or width (in
pixels) of an image. To specify the height, include a colon after the merge field name,
followed by H=[height in pixels]. To specify the width, include a colon after the merge
field name, followed by W=[width in pixels].
The image proportions (aspect ratio) are automatically maintained.
For example, to indicate that the image should be 100 pixels wide:
{{IMAGE:OPPORTUNITY_IMAGE_FIELD:W=100}}
Merge Images via Salesforce Id
Instead of providing a complete URL to an image, if the image exists in Salesforce as a
Document (record Id beginning in “00P”) or Attachment (record Id beginning in “015”),
you may you may pass the identifier of the Document or Attachment and Conga
Composer will determine the rest of the image’s URL. You will still use the field prefix
IMAGE: but do not have to build a custom field to house the image’s URL but rather will
retrieve the image’s Id via a SOQL query.
Example:
You have uploaded an image as an Attachment (on the Notes and Attachments related
list) on an Account and want to merge that image into your Word template. Rather than
building a custom field on your Account to house the URL of that image (as we did in
the previous section, “Image Field”), you reference the image by its Salesforce Id.
First, you build a SOQL query to retrieve the Id of that Attachment:
SELECT Id FROM Attachment WHERE ParentId = '{pv0}'
Alternately, if you only want to return Attachments that contain .jpg, .gif, or .png in the
file name (to indicate that you only want images retrieved), you could use this SOQL
query:
SELECT Id FROM Attachment WHERE ParentId = '{pv0}' AND (Name LIKE '%.jpg%'
OR Name LIKE '%.gif%' OR Name LIKE '%.png%')
Heads Up
You may specify either height or width, but not both.
© 2015 Conga
Release 8
59