Skip to main content

How to create a custom button to run workflows from Salesforce

Add a custom button to any Salesforce layout and let your team trigger altaFlow workflows without leaving the CRM.

Updated this week

This article walks through how to create a custom button in altaFlow for Salesforce. As an example, we'll build a document package for new employee onboarding. Before sending, forms are automatically pre-filled with data from Salesforce. Once the employee submits them, the data syncs back to the matching Salesforce record.

Prepare the form for recipients

First, prepare the form to send to the new employee. In this example, we'll use a W-4 form in PDF format.

1. Open Salesforce and go to altaFlow Admin Tools.

2. Click Create workflow. The workflow setup wizard opens in a new tab.

3. Click Add document to upload the document that will be sent to the recipient to complete.

Tip: If the document doesn't contain fillable fields, you can add them from the panel on the left.

4. Select the fields the recipient will complete.

5. In the right panel under Text field options, give each field a clear name in the Database field name. This makes it easier to identify and map the fields later when linking them to your data.

6. Mark the required fields so the recipient must complete them before submitting the document.

7. Click Continue.

Generate personalized documents

You can also add other documents to send as part of the same package. In this example, we'll include an offer letter automatically filled with data for each recipient.

1. Click Add documents in the bottom right corner above the document list.

2. In the panel that opens on the right, select Document generation. A text editor will open.

3. Add your letter, offer, or any other content, including text and images.

To insert dynamic data into the document, use tags. For example, if you're sending an offer lett and need the candidate's name to appear, create a tag. Tags pull data from Salesforce, giving each recipient a personalized document.

4. Click Tags in the top right corner.

5. In the Tag properties panel, enter Name in Field name. Then click Insert tag to place it in the document.

If this document also requires the recipient to sign or provide information, add fields.

6. Click Fields in the top right corner and add the fields the recipient needs to complete.

7. When adding fields, use clear names in Field name so you can easily tell fields apart later.

8. To add helper text inside a field for the recipient, go to Advanced and use Placeholder.

9. Click Continue.

10. In the document list at the bottom left, rename your document as needed.

Tip: You can drag and drop documents in the list to change the order in which recipients see them.

Prepare the Variables document

  1. In the bottom left corner, click Documents.

  2. Above the document list, click Add documents and select Form or survey in the panel on the right.

3. Rename the Heading to Variables for clarity.

4. From the left panel, add an Email field and rename it to Employee email.

5. Click Continue.

6. In the document list at the bottom left, rename the document to Variables.

Configure the workflow

A workflow is built from steps. The number of steps depends on your process.

In this example, the workflow is started by an initiator. A new employee completes the documents. After completion, the documents are sent to the employee and exported to Salesforce under their record.

Step 1. Initiator

The first step is created automatically when you add a document. Rename it to Initiator. The initiator kicks off the document package and can review everything before it goes out. The initiator will only be able to view the documents sent to recipients.

  1. Click the gear icon to open step settings.

2. Next to each document name, click Manage document access (document icon with a gear).

3. Under Allow access, select Recipient can view, then click Apply.
Repeat this for all documents in this step.

4. Hide the Variables document from the initiator. Next to the document name, click Manage document access, select Hide document, then click Apply.

5. Scroll up to Recipient, select Current user, then click Apply.

Step 2. Employee

Now add a second step. In this step, the new employee receives the document package to complete.

  1. Click the plus icon and select Step.

  2. Rename the step to Employee.

  3. Click the gear icon to open step settings.

  4. Under the document the employee must complete, click Assign fields.

5. Select all fields the employee needs to fill in, then click Assign. Repeat this for all documents the employee must complete.

6. Hide the Variables document from the employee. Next to the document name, click Manage document access, select Hide document, then click Apply.

7. Scroll down to Recipient. Under Send documents, select Email or phone.

8. In Email or phone, click the input field and then click +Data variable.

9. From the dropdown, select the Variables document and the Employee email field.

10. If needed, customize the message for the recipient. For example, to insert the recipient's name, click +Data variable above the message field, select the Offer letter document, and choose Name.

11. Click Apply to save the step.

Step 3. Pre-fill documents with Salesforce data

  1. Go back to the Initiator step, click Bots on the step card, then click Add bot.

2. Select the Pre-fill from Salesforce records bot.

3. Click Install bot.

4. Click Connect, select the Salesforce account to pull data from, then click Continue.

5. Under Select base objects and map fields, choose Contact.

6. Scroll down to Map object fields to document fields.

7. With Contact selected as the object, choose Name from the dropdown.
On the right, select the document and the Name field that should receive this value.

8. Click Map another field and map additional fields as needed.

9. Map the email field for the Variables document. Set Object name to Contact, select Email, then choose Variables and Employee email on the right.

10. Click Continue to save.

11. Go to Select starting record, make sure Start from Salesforce is selected, then click Apply.

Step 4. Merge completed documents

Once the documents are completed, you can merge them into a single PDF and send it to Salesforce. To do this, add a separate step.

  1. Click the plus icon and select Bot.

2. Find Merge completed documents to PDF and click it.

3. Click Install bot.

4. Set the exported document name. Under Exported document name, click +Data variable, select the document that contains the employee name (for example, Offer letter), choose Name, and add the word package after the variable.

5. Under Reference name, enter a name to identify the merged file, for example Merged package.

6. Under Documents to merge, select the documents that should be combined into one file.

7. Click Continue, then Apply.

Step 5. Export the merged document to Salesforce

After the employee submits their documents and they're automatically merged, set up the sync with Salesforce so the merged file is added to the matching record. Add a step to handle the export.

  1. Click the plus icon and select Bot.

2.Find Export to Salesforce and click it.

3. Click Install bot.

4. Click Connect and choose the Salesforce account where the document will be exported.

5. Under Select destination and documents, choose Contact and select Merged package.

6. Under Select destination, make sure Files is selected.

7. Under If such file already exists, select Create new.

8. Click Continue, then Apply.

Step 6. Send an email notification after completion

In this workflow, we'll notify the new employee once they've completed the documents. Add a bot that sends an email notification after completion.

  1. Click the plus icon and select Bot.

  2. Find Email on documents completion and click it.

  3. Click Install bot.

4. Under Send email to, select Email address.

5. Click + Data variable, choose the Variables document, then select Employee email.

6.Customize the message if needed.

7. Uncheck Show View Documents button.

8. Under Attach documents, select Merged package.

9. Click Apply to save the settings.

Your New employee offer letter workflow is now ready. Click Publish at the bottom of the screen.

Create a custom button in Salesforce

If you are creating a custom button for the first time, please complete the User Permissions setup as described in this article

  1. Open Salesforce and go to altaFlow Admin Tools.

  2. In the left navigation panel, select Custom buttons and click Create button.

3. Enter a Button label and Description, then click Next to action settings.

4. Under Action, select Run workflow.

5. Under Workflow, select the workflow you created.

6. Under Mode, choose the option that allows the initiator to review documents before sending them.

7. Click Next to layouts and lists.

8. Under Select layout and list, choose where the button should appear. In this case, select Contact.

9. Click Finish.

The custom button is now set up on the Contact layout and ready to trigger the workflow you created.

Run the workflow from Salesforce

  1. Open Salesforce and go to Contacts.

  2. Select the required contact.

  3. Click the custom Offer button.

4. A new window opens with the documents ready for review.

Did this answer your question?