Important 
This article outlines instructions for the Process Builder, which is in the process of being retired. This article is in place for reference for existing automations. Instead of using the Process Builder, it is recommended to configure new automations using Flow. For instructions on how to set up this automation in Flow, see Automatically Clone Templates Using Flow.
- Starter
- Standard
- Premium
Since TaskRay is a 100% Salesforce native application, the Lightning Process Builder can be used to automate various TaskRay processes. Here are a couple of examples of what you can do with TaskRay + Process Builder:
- Automatically create a Customer Onboarding TaskRay Project from a saved template when the Opportunity is marked as "Closed Won" in Salesforce.
- Automatically create a Sales Activity TaskRay Project from a saved template when a new Opportunity is created in Salesforce.
- Automatically create a Webinar Prep TaskRay Project from a saved template when a new active webinar campaign is scheduled.
- Automatically complete checklist items when a task is finished.
- Auto-archive TaskRay Projects when they are 100% completed.
Although there are many other different ways that the Process Builder can be used for TaskRay, the example that we will focus on in this article will show how to automatically create TaskRay projects when you close (and win!) opportunities in Salesforce. These instructions should give you a general understanding of how to use the Process Builder with TaskRay, but you can further modify the criteria and build automated processes that are most helpful for your organization.
Step 1: Set Everything Up in TaskRay
Create a Customer Onboarding Project Template
First things first, for the example that we are using, it is important that a Customer Onboarding template project is created in TaskRay. Keep in mind, depending on what you are trying to automate, this step might not be applicable.
You can read more about creating templates here.
Add the Account Lookup Field to the Project Details Layout [Admin]
In our example, when an Opportunity is Closed Won in Salesforce, we want a new Customer Onboarding project to be created in TaskRay. It is a good idea to also link the new Customer Onboarding project to the Account that is related to the closed Opportunity. To do so, you would need to have the Account lookup field on the Project Details. If it is not already added to the Project field set, you can follow the Modify Fields Displayed on Project or Task Details instructions to do so.
In terms of the process itself, we will set up the process in a way that will automatically populate the Account field on the Project Details of the cloned Customer Onboarding project. Keep in mind, in order for this field to populate in Project Details, the Opportunity must be linked to an Account.
Step 2: Build the Process Using the Process Builder [Admin]
Now that TaskRay is all set up, 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 Opportunity object, because that is where the initial action will take place.
- On the canvas, click on + Add Object.
- For the Object field, select Opportunity.
- 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 status of the Opportunity to Closed Won.
- 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 = [Opportunity].Stage
- Operator = Equals
- Type = Picklist
- Value = Closed Won
- 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 Opportunity status is changed to Closed Won.
- 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 (Opportunity stage changes to Closed Won). In our example, the action that should occur when the process is fired is the clone of the Customer Onboarding template that will create a new project for the closed Opportunity. For this purpose, we will need the record ID of the Customer Onboarding template.
Get Template ID
- In a new browser tab, open any Salesforce page.
- Locate the New Customer Onboarding template project. You can either search for it in Salesforce or locate it in TaskRay.
- With the template open in the standard Salesforce interface, we will need to make a note of the record ID, which will be part of the URL. In the browser address bar, highlight and copy the record ID, which will be listed after "salesforce.com/".
Return to Process Builder
Return to the Process Builder tab in your browser.
- On the canvas under Immediate Actions, click on + Add Action.
- For Action Type, select Apex.
- Enter the Action Name.
- For Apex Class, select Clone a TaskRay Project.
Tip: If you wanted to only clone a task (vs. cloning an entire template project), you could select Clone a TaskRay Task in this section. - Next, we need to define the source that triggers this clone as well as the Customer Onboarding template, which we are cloning. Under Set Apex Variables, select the following:
- Source Object Id line:
- Type = Field Reference
- Value = [Opportunity].Id
- Template Project Id line:
- Type = ID
- Value = <record ID of the Customer Onboarding template (from section above)>
- During this cloning process, it might also be a good idea to automatically define the new project's name. For example, we might want our cloned projects to be named as "Opportunity Name: Customer Onboarding" (e.g. "Acme Inc.: Customer Onboarding"). Click on + Add Row and select the following:
- Field = Project Name
- Type = Formula
- Click on Build a formula...
- Build the formula. For insert:
- Field = [Opportunity].Name
- In the formula text box, type in + after [Opportunity].Name
- Type in ':Onboarding' (or any other verbiage) after the +
- Click Use this Formula.
- It might also be a good idea to map the newly created onboarding projects back to the Salesforce Account that resulted from the Closed Won Opportunity (referencing the Account field from the Opportunity that triggered the process). To do so, click on + Add Row and select the following:
- Field = 1. Map Source Field
- Type = String
- Value = AccountID
- Click on + Add Row to add another row and select the following:
- Field = 2. To Project Field
- Type = String
- Value = TASKRAY__trAccount__c (or whichever Account field you are using on the TaskRay Project)
Note: The 'Map Source Field' / 'To Project Field' variable can only be used once in the Apex cloning action. If you would like to map additional fields, you would need to create a new "Update Records" action and update specific fields within that action. Please reach out to support@bracketlabs.com if you need further assistance with this. - Lastly, we may want to set up the automation, so that the Start Date of the first task in the new onboarding project is the same as the Close Date of the Salesforce Opportunity. This is to ensure that when the template is cloned, all tasks within the project will be lined up and dated correctly. Click on + Add Row and select the following:
- Field = Starting Date of First Task
- Type = Reference
- Value = [Opportunity].Close Date
Tip: If you want the first task of the project to start a certain number of days after the Close Date of the Opportunity, then select Formula instead of Reference and create a formula: Opportunity Close Date + 1 (or however many days from the close date you'd like the task to start). - 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 the Opportunity record that you want to mark Closed Won. Change its status to Closed Won. Now you can go to TaskRay to see if the new Customer Onboarding project has been created.