Automation example - Create Salesforce Task to help guest reviewer
Background
Let’s say that you have sent out a document for your client to review (and hopefully sign!). In some cases, clients might have questions about your document but don't immediately reach out to you. This delay can cause misunderstandings and impact their review process. Being proactive in supporting your clients during document review is crucial.
In this tutorial, we'll guide you through creating a Salesforce Flow that automatically generates a Salesforce Task for you when your client starts reviewing your document. This Task will serve as a reminder for you to contact the client and offer assistance, ensuring timely support and addressing any queries they might have.
Idea
Let's process an event if it has below details:
The event is a Documill Leap Project Event.
The event type is about status changes of a Leap Task.
The Leap Task is for a Reviewer.
The Reviewer is a guest user.
And automatically create a new Salesforce Task with the below details:
It contains a reminder to contact the client.
It is assigned to the person who owns the Record where the Leap Project was created.
It is related to the Record where the Leap Project was created.
Furthermore, this tutorial assumes that:
The Documill Leap Projects component is configured in your Opportunity page layout. So the new Salesforce Task will be visible under Opportunity related Task.
You have done the configuration to send Project Event Data to Salesforce.
Build the Salesforce Flow
Create a new Salesforce Flow
1. In Salesforce, click [⚙] button on the top right corner.
2. Click [Setup] option.
3. In Setup page, search for “flows”
4. Under Process Automation, click Flows entry.
5. In Flows page, click [New Flow] button.
6. In New Flow dialog, choose “Platform Event - Triggered Flow”
7. Click [Create] button.
8. In Choose Platform Event panel, search for “Documill Leap Project Event”.
9. Click [X] button to close the panel.
You have just prepared a Salesforce Flow that will run whenever Documill Leap Project Event is sent from Leap.
Add Decision element
Next, let’s add the logic so that the Salesforce Flow will continue based on our criteria.
1. Between the Start and End elements, click [+] button.
2. Click [Decision] entry.
3. In New Decision dialog, fill in with below details
Label | Check Task Reviewer In Progress |
---|---|
API Name | Check_Task_Reviewer_In_Progress |
New Outcome Label | Task Reviewer In Progress |
Outcome API Name | Task_Reviewer_In_Progress |
Condition Requirements to Execute Outcome | All Conditions Are Met (AND) |
4. Fill in the first condition
Resource | $Record (Documill Leap Project Event) > Event Type |
---|---|
Operator | Equals |
Value | TaskStatusChange |
5. Click [+ Add Condition] button, and fill in the second condition
Resource | $Record (Documill Leap Project Event) > Event Collaborator Type |
---|---|
Operator | Equals |
Value | REVIEWER |
6. Click [+ Add Condition] button, and fill in the third condition
Resource | $Record (Documill Leap Project Event) > Event Outcome |
---|---|
Operator | Equals |
Value | IN_PROGRESS |
7. Click [+ Add Condition] button, and fill in the fourth condition
Resource | $Record (Documill Leap Project Event) > Event Organization Member |
---|---|
Operator | Equals |
Value | $GlobalConstant.False |
8. Click [Done] button.
The Decision element now controls how the Salesforce Flow will run according to the conditions we set.
Get the Record ID where the Leap Project was created
Next, we will read a custom object called Record Leap Projects List. This custom object stores the connection between a Leap Project and the Record where the Leap Project was created.
1. Under Task Reviewer In Progress outcome, click [+] button.
2. Click [Get Records] entry.
3. In New Get Records panel, fill in below details.
Label | Record ID where Leap Project was created |
---|---|
API Name | Record_ID_where_Leap_Project_was_created |
Object | Record Leap Projects List |
4. Filter the records with below criteria.
Condition Requirements | All Conditions Are Met (AND) |
---|---|
Condition 1 - Field | documill_leap__Project_Id__c |
Condition 1 - Operator | Equals |
Condition 1 - Value | $Record (Documill Leap Project Event) > Event Project ID |
5. Keep other settings as they are.
Sort Order | Not Sorted |
---|---|
How Many Records to Store | Only the first record |
How to Store Record Data | Automatically store all fields |
6. Click [X] button to close the panel.
Now we know the ID of the Record where the Leap Project was created.
Get the Opportunity based on the Record ID
Next, let’s find the Opportunity Record based on the ID we retrieve in the previous step.
1. Under the Get Records element, click [+] button.
2. Click [Get Records] entry.
3. In New Get Records panel, fill in below details.
Label | Get Opportunity by Record ID |
---|---|
API Name | Get_Opportunity_record_by_ID |
Object | Opportunity |
4. Filter the records with below criteria.
Condition Requirements | All Conditions Are Met (AND) |
---|---|
Condition 1 - Field | Id (Opportunity ID) |
Condition 1 - Operator | Equals |
Condition 1 - Value | Record ID where Leap Project was created > documill_leap__Record_Id__c |
5. Keep other settings as they are.
Sort Order | Not Sorted |
---|---|
How Many Records to Store | Only the first record |
How to Store Record Data | Automatically store all fields |
6. Click [X] button to close the panel.
Prepare the message for Salesforce Task
Before we create a new Salesforce Task, let’s first prepare the message that will be the Subject of the Salesforce Task. This Subject will then be visible in the Opportunity.
1. On the left corner, click [Toggle Toolbox] button.
2. Click [New Resource] button.
3. For Resource Type field, select Formula.
4. Under New Resource dialog, fill in below details.
Resource Type | Formula |
---|---|
API Name | TaskSubjectToContactGuestReviewer |
Data Type | Text |
Formula |
CODE
Example result of the formula:
|
5. Click [Done] button.
Add Action to create a new Salesforce Task
Next, let’s add the main action of this Salesforce Flow; create a new Salesforce Task.
1. Under the second Get Records element, click [+] button.
2. Click [Action] entry.
3. In New Action dialog, search for “New Task” action.
4. Fill in below details.
Label | Create Task to help Reviewer |
---|---|
API Name | Create_Task_to_help_Reviewer |
Assigned to ID |
|
Related to ID |
|
Status | Not Started |
Subject |
|
5. Click [Done] button.
Save and activate
Now, let’s save this new Salesforce Flow and activate it.
1. On the top-right corner, click [Save] button.
2. Fill in below details.
Flow Label | Create Task to contact reviewer |
---|---|
Flow API Name | Create_Task_to_contact_reviewer |
3. Click [Save] button.
4. On the top-right corner, click [Activate] button.
Done! The new Salesforce Flow is now ready.
Test the Salesforce Flow
In order to see how the new Salesforce Flow works, let’s follow below steps:
1. Open an Opportunity.
2. Create a new Leap Project.
3. Make sure to assign a Contact from the Opportunity Account as a Reviewer.
4. Set the Leap Project as Live
5. Work on the Leap Project until it reaches the Reviewer.
6. As the Reviewer, open the Review Task in Leap.
This should trigger the Salesforce Flow we have just created.
7. Refresh the Opportunity page and check for its related Task.
Conclusion
In this tutorial, you built an automation that can create a new Salesforce Task when a client is about to start reviewing a document.
To build that, you have:
Created a Salesforce Flow that is triggered by Documill Leap Project Event.
Used a Decision element to filter the relevant event.
Used Get Records elements to retrieve relevant data.
Used Record Leap Projects List custom object to find the Record where a Leap Project was created.
Created a Formula to compose a useful message.
Used a New Task action to create a Salesforce Task.
This tutorial is one example of how you can utilize Documill Leap Project Event. If you have more ideas on how you would use Documill Leap Project Event, we would love to hear that!