Since TaskRay is a 100% Salesforce native application, the Lightning Process Builder can be used to automate various TaskRay processes.
The Stitcher allows you to combine template projects and task groups to build new projects or modify existing ones. Using the Process Builder, you can automate the Stitcher functionality to automatically create or modify projects or tasks when something happens in Salesforce.
In this article we will be leveraging the "Stitch a TaskRay Task" Apex process builder action. This process builder action can be used to add up to 5 template checklists to an existing task, or clone a template task and insert up to 5 template checklists on the task. Read more about Checklist Templates.
In this article, we will use an example of stitching together a task once its priority is changed to high.
As you go through these instructions, keep in mind that there are many other possibilities for customizing the process and you can modify the setup to suit the specific needs of your organization.
If you would like to learn how to stitch together a project using the Process Builder, see this article: Automatically Stitch Projects Using the Process Builder.
Step 1: Set Everything Up in TaskRay
Create Templates
The first step of the process is to make sure that you have all the necessary template checklists, or in this case building blocks, set up in TaskRay. Any checklists that are added to template tasks are considered to be template checklists and, therefore, can be used as building blocks for stitching together new tasks. You can learn more about creating templates here.
It is up to you how you want to keep the templates organized, but for this example, the first thing that you will need to do is make sure that you have a basic template project in TaskRay where you will keep all of your building blocks. Within this template project we will create a template task named Template Checklist Container to house all of our template checklists. Once this template task is created, create your High Priority Checklist template in the checklist tab of the task detail view.
- Open Task Details of the template task on which the template checklist is located.
- Click on the Checklist tab.
- Locate the checklist group that you want to use for stitching (in this case, High Priority Tasks). Click on the Info icon next to any checklist item in that list.
- This will take you to the standard Salesforce interface for the checklist item record. On that record page, look for the Checklist Group lookup field and click on the Checklist Group Name that is in that field.
- This will open the Checklist Group record. In the browser address bar highlight and copy the record ID. You will need this record ID later in the process.
Step 2: Build the Process using the Process Builder
Now that TaskRay is all set up and you have the template checklist created, the next step is to build the actual automated process.
Create a New Process
- From Setup, navigate to:
- Lightning: Process Automation | Process Builder.
- Classic: Create | Workflow & Approvals | Process Builder.
- Click New.
- Enter the Process Name, API Name, and Description.
- For The process starts when field, select A record changes.
- Click Save.
Select the Object for the Process
The first thing that you need to do is select the object that will trigger the automated process. In this case, we will select the TaskRay Task object, because that is where the initial action will take place (Task priority will change to High).
- On the canvas, click on + Add Object.
- For the Object field, select TaskRay Task.
- Under Start the process, select When a record is created or edited.
- Click Save.
Define the Criteria That Triggers the Process
The next part of building the process is to define the criteria that will trigger the process. In our example, it would be the act of changing the value of the Priority field on TaskRay Task to High.
- On the canvas, click on + Add Criteria.
- Enter the Criteria Name.
- Under Criteria for Executing Actions, select Conditions are met.
- Under Set Conditions, select the following:
- Field = [TaskRay Project Task].Priority
- Operator = Equals
- Type = Picklist
- Value = High
- Under Conditions, select All of the conditions are met (AND).
- Click on Advanced to expand additional settings and select the Yes checkbox.
- This means that we want to execute this action only when the specified changes are made to the record. In our case, we want the action to fire only when the Priority is changed to High.
- Click Save.
Define the Actions that Occur when the Process Runs
Next, you need to define the actions that should occur when the process is fired. In our example, the action that should occur when the process is fired is the creation of a new checklist on the task.
- On the canvas under Immediate Actions, click on + Add Action.
- For Action Type, select Apex.
- Enter the Action Name.
- For Apex Class, select Stitch a TaskRay Task.
- Under Set Apex Variables, click on + Add Row and select the following:
- Field = New Task?
- Type = Boolean
- Value = False
Tip: If you were adding a stitch to a new task, you would select True for this row and then add new rows to configure what template task to clone and then add a checklist to.
- Click on + Add Row and select the following:
- Field = Existing Task Id
- Type = Reference
- Value = [TaskRay Project Task].Record Id
- Click on + Add Row and select the following:
- Field = 1. Checklist Group Id
- Type = Id
- Value =< enter the ID of the Existing High Priority Checklist template you found earlier >
Tip: This row specifies the ID of the template checklist that will be added. Note that there are four other similar fields available where you can add additional checklists.
- Click Save.
- Click Activate in the top right corner.
Step 3: Test It Out!
It's time to see how all of this works together. Go to any TaskRay Task and change it's Priority to High. You should see a new copy of the template checklist "stitch" into the task!