Skip to content
Get startedDashboardSupport
Print & Mail
Integrations
Salesforce Print & Mail

Sending triggered based mailings using Salesforce FLOWS

Set up Salesforce Flows to automatically trigger PostGrid mailings based on CRM events, such as record changes or scheduled actions.

Using Salesforce’s FLOW functionality, you can send out mailings based on various triggers. These include instances when a contact is updated, a new lead is created, or a deal is closed.

1. Click on the Setup icon on the main screen and then click on Setup

Section titled “1. Click on the Setup icon on the main screen and then click on Setup”
Salesforce main screen with the Setup gear icon highlighted in the top navigation bar

2. Search for “FLOW” in the Quick Find and click on Flows

Section titled “2. Search for “FLOW” in the Quick Find and click on Flows”
Salesforce Setup Quick Find search box with FLOW entered and the Flows option highlighted in the results Salesforce Flows list page with the New Flow button highlighted

4. Select a Trigger type and click on “Create”

Section titled “4. Select a Trigger type and click on “Create””
Salesforce New Flow dialog showing trigger type options such as Record-Triggered Flow, with the Create button visible

5. Select the Custom Object for which you want to trigger the flow

Section titled “5. Select the Custom Object for which you want to trigger the flow”
Salesforce Flow configuration panel showing the Object field dropdown for selecting a custom object to trigger the flow

6. Configure the Trigger and Set Entry Conditions. Once the trigger is configured click on Done

Section titled “6. Configure the Trigger and Set Entry Conditions. Once the trigger is configured click on Done”

You can set any condition that you want to, for example, you want to trigger the flow for a contact from a specific country.

Salesforce Flow trigger configuration showing entry conditions settings with field, operator, and value inputs Salesforce Flow trigger setup with the Done button highlighted after configuring entry conditions

1. Click on the ”+” sign and select “Subflow” in Interaction

Section titled “1. Click on the ”+” sign and select “Subflow” in Interaction”
Salesforce Flow canvas with the plus sign add element button highlighted Salesforce Flow element picker showing the Interaction section with Subflow option selected
  • If you are using a PDF please select “Send Letter(Content)” or “Send Postcard(Content)
  • If you are using an HTML template please select “Send Letter(Template)” or “Send Postcard(Template)
  • If you are using an HTML template with merge variables please select “Send Letter(Template Merge Variable)” or “Send Postcard(Template Merge Variable)
Salesforce Subflow configuration panel listing available PostGrid subflows such as Send Letter(Content), Send Letter(Template), and Send Postcard options

2. To set any Input Values, first switch the toggle to include the input

Section titled “2. To set any Input Values, first switch the toggle to include the input”
Salesforce Subflow input values panel with a toggle switch being enabled to include an input field

3. Set up the Input values for the additional services

Section titled “3. Set up the Input values for the additional services”

The additional services include, Select a return envelope, Envelope type, Page Size, Extra Service, Mailing Class, Color, Double Sided, Insert Blank Page for Address, Perforate First Page and Express Delivery.

Due to Salesforce constraints, the input values for the following fields must be entered manually as text rather than mapping the global variable constants (True/False).

  1. addressPlacement:
  • top_first_page - to add the address on the top of the first page
  • Insert_blank_page - to add the to and from address fields on a blank page
  1. extraService:
  • certified - to send as certified mail
  • certified_return_receipt - to send as certified mail with a return receipt
  • registered - to send as registered mail
  1. perforatedPage: 1
  2. mailingClass:
  • standard_class
  • first_class

By default, all mail is sent as First Class or the fastest non-express postage available in the destination country. You can override this for a lower postage fee by supplying a mailingClass parameter with the value standard_class

Salesforce Subflow input values panel showing additional service fields such as mailingClass, extraService, and addressPlacement with text values entered

1. Add the object record ID for each recipient field

Section titled “1. Add the object record ID for each recipient field”

Please note that capturing the record ID is important to ensure that the correct information is captured whenever an object is created or updated.

Salesforce Subflow input panel showing the recipient record ID field being mapped from the triggering object

To ensure accurate delivery of the mail, please make sure that all required fields for the recipient address are properly configured.

Salesforce Subflow input panel with all recipient address fields configured, including name, address line, city, state, and country

If a valid future date is provided, it can be added as the sendDate. If no value is provided, the default sendDate will be set as today+2.

Salesforce Subflow input panel showing the sendDate field with a date value mapped from the flow

For adding the sender address first create a contact in Salesforce or use an existing record in Salesforce.

You can either manually input the values for each field or alternatively, you can directly add a sender_Record_Id. To add the contact ID for the sender, you first need to deploy the contact on the PostGrid platform.

Salesforce Subflow input panel showing sender address fields with manual values entered for name, address, city, state, country, and the sender_Record_Id field

Please note that Sender Address is mandatory for sending letters, but optional for sending postcards.

1. Click on PostGrid contacts to get the record ID for the sender address

Section titled “1. Click on PostGrid contacts to get the record ID for the sender address”
Salesforce navigation showing PostGrid Contacts list with contact records displayed Salesforce PostGrid contact detail page for a specific contact record

3. Copy the contact ID from the browser URL and paste the contact Id in the sender_Record_Id field

Section titled “3. Copy the contact ID from the browser URL and paste the contact Id in the sender_Record_Id field”
Browser address bar showing the Salesforce PostGrid contact URL with the record ID highlighted Salesforce Subflow input panel with the sender_Record_Id field filled in using the copied contact ID

If you are manually entering the country code for the receiver or sender, please ensure that it is in the ISO 3166 format.

  1. United States of America: US
  2. Canada: CA
  3. United Kingdom: GB
  4. Australia: AU
  • You can either add a content_Record_ID to the Subflow or you can also pass any downloadable link to the pdfLink.
  • If you provide both, a PDF link and the content ID then priority will be given to the PDF link.
Salesforce Subflow input panel showing the content_Record_ID field for adding a PDF content record ID Salesforce Subflow input panel showing the pdfLink field for passing a downloadable PDF URL

If you are using an HTML template, you first need to create a template in Salesforce. Similar to adding the contact ID for the sender, for the template you first need to deploy the template on the PostGrid platform.

Salesforce Subflow input panel for an HTML template subflow showing the Template_Id field

1. Click on PostGrid Templates and then click on the desired Template

Section titled “1. Click on PostGrid Templates and then click on the desired Template”
Salesforce navigation showing the PostGrid Templates list with template records displayed Salesforce PostGrid template detail page for a specific HTML template record

2. Copy the template ID from the browser URL and paste the template Id in the “Template_Id” field

Section titled “2. Copy the template ID from the browser URL and paste the template Id in the “Template_Id” field”
Browser address bar showing the Salesforce PostGrid template URL with the template record ID highlighted Salesforce Subflow input panel with the Template_Id field filled in using the copied template ID

Salesforce supports 40 merge variables from var1_0 to var4_9 for Letters and 20 merge variables from var1_0 to var2_9 for Postcards.

Below is the format to add merge variables in the HTML template that you create on the dashboard:

  1. Account number: {{var1_0}}
  2. Account Id: {{var1_1}}
Salesforce Subflow input panel showing merge variable fields var1_0 through var2_9 for mapping template variables

Then map the variables in the flow with the required fields in the object

Salesforce Subflow input panel showing merge variable fields mapped to object fields such as account number and account ID

1. Click “Done” after completing the configuration

Section titled “1. Click “Done” after completing the configuration”
Salesforce Subflow configuration panel with the Done button highlighted after all input values are set Salesforce Flow canvas toolbar with the Save button highlighted

3. Add a name to the workflow under “Flow Label” and click on Save

Section titled “3. Add a name to the workflow under “Flow Label” and click on Save”
Salesforce Save Flow dialog with the Flow Label field filled in and the Save button highlighted

4. To check if the workflow is working fine, Click on “Debug” and click on “Run Immediately”

Section titled “4. To check if the workflow is working fine, Click on “Debug” and click on “Run Immediately””
Salesforce Flow canvas toolbar with the Debug button highlighted Salesforce Flow Debug panel with the Run Immediately option selected

5. Select a custom object to run the workflow on and click on “Run”

Section titled “5. Select a custom object to run the workflow on and click on “Run””

Please ensure that you select a contact that meets the configured triggered conditions to ensure accurate testing.

Salesforce Flow Debug panel showing the custom object selector for choosing a test record to run the workflow on Salesforce Flow Debug panel with a contact record selected and the Run button highlighted

6. Click on Details panel to check the debug details

Section titled “6. Click on Details panel to check the debug details”
Salesforce Flow debug results screen with the Details panel open showing execution steps and status

7. Click on “Activate” to activate the workflow

Section titled “7. Click on “Activate” to activate the workflow”
Salesforce Flow canvas toolbar with the Activate button highlighted to enable the workflow
  • Error Log → If you are using a flow and create an order using a template or content or pdf but the order is not created then you can check the error/cause in the error log object.
  • To use Error Log → setup → in the quick find box search tabs → create a new tab for the error log.
  • After creating a tab for the error log you can search for it.
  • You can also check the API logs in the PostGrid Dashboard
Salesforce Error Log object list view showing error records with cause details for failed PostGrid flow orders