- Standard
- Premium
Since TaskRay is a 100% Salesforce native application, the Lightning Process Builder and Flow can be used to automate various TaskRay processes.
In this article we will be leveraging the TaskRay Pending Action object. This object is used to create guided step-by-step actions on TaskRay Tasks for users to follow whenever certain criteria is met.
In this article we will create an action interview that prompts a task owner to upload a document on an "Upload Lease" TaskRay Task whenever the task's status is changed from Holding to Prioritized. Then, as part of the automation, once the document is uploaded to the task, the task will automatically move to the Finished column. In this specific example, we will use the TaskRay Today Lightning Component as the place where the user will execute these actions.
In order to accomplish this, we will create a screen flow to handle the uploading of the file and a process builder to insert the Pending Action record so that the user is notified that they must complete the action.
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.
Here is a visual for what the process would look like once fully configured:
Prerequisites
- Install TaskRay.
- Install TaskRay Lightning Components.
- Enable Lightning Runtime for Flows.
Instructions:
- From Setup, navigate to:
- Lightning: Process Automation | Process Automation Settings.
- Classic: Build | Create | Workflow & Approvals | Process Automation Settings.
- Select Enable Lightning runtime for flows.
- Click Save.
- From Setup, navigate to:
Step 1: Set Everything Up in TaskRay
Since we will be using the Task Name "Upload Lease" as a key identifier in our process builder, make sure that you have a template or ad hoc project that includes a task with this name. You can learn more about creating templates here.
For the purpose of this article, we will be using a live project that contains an "Upload Lease" task. This will allow us to focus on the pending action process; most actual implementations will be using project templates.
Step 2: Create the Screen Flow
First let's start building the screen flow we will present to the user to coomplete. In general, this flow will take in a input variable of a TaskRay Task Id, present a lightning component to upload a file to the Task, then moved the Task to the Finished Column.
- From Setup, navigate to:
- Lightning: Process Automation | Flows.
- Classic: Create | Workflow & Approvals | Flows.
- Click New Flow.
- In Flow Designer, click on the Resources tab in the left sidebar.
- Under CREATE NEW, double click on Variable.
- Enter Unique Name: recordId. Leave all the other fields as is.
- Click OK.
- In the left sidebar, click on the Palette tab.
- Under USER INTERFACE, select Screen and drag it onto the canvas. This will allow you to create a new screen that will appear for the user to upload the document to the "Upload Lease" TaskRay Task.
- Enter Name (e.g. "Upload Lease").
- Click on the Add a Field tab.
- Under EXTENSIONS, select Lightning Component and drag it to the right side of the window (under "Upload Lease").
- Once it's there (should appear as [Lightning Component]), click on it to configure it.
- This will open Field Settings on the left side of the screen. Enter Unique Name (e.g. "uploadLeaseComponent").
- Click into the Lightning Component field and select forceContent:fileUpload.
- Under the Inputs tab, enter File Upload Label (e.g. "Upload Lease").
- Click into the Related Record ID field, click on Variables in the dropdown menu, and select recordId (variable that we created earlier).
- Click on the Outputs tab.
- Click on the Trash Can icon next to the empty Attribute row.
- Click OK to save the screen.
- Enter Name (e.g. "Upload Lease").
- Back on the canvas, designate the Screen that you just created as the starting point of the process. Hover over the Screen box and click on the green down arrow icon.
- In the left sidebar, under the Palette tab, under DATA, select Record Update and drag it onto the canvas.
- Enter Name (e.g. "Finish Task").
- Click into the Update field. In the dropdown menu, under Custom, select TASKRAY__Project_Task__c.
- In the first row, set the following:
- Field = Id
- Operator = Equals
- Value = (variable created earlier) recordId
- In the second row, set the following:
- Field = TASKRAY__List__c
- Value = Finished
- Click OK.
- Back on the canvas, connect the Screen box with the Record Update box by dragging an arrow from Screen to Record Update (from the square at the bottom of the Screen box).
- Now, let's save our work. Click on the Save button in the top left corner of the Flow screen.
- Enter Name (e.g. "Upload Lease").
- Click OK. (If you get a warning message, click OK again.)
- Close out of the Flow configuration screen by clicking on the Close button in the top left corner.
- Back on the flow details page, click on Activate next to the flow that was just created.
Step 3: Build the Process to Create the Pending Action Record
Now that the flow is created, we need to create the Pending Action record that will be created at the correct time, so that the task owner will be presented with the screen flow to upload the lease when the Task is moved to the Prioritized column in TaskRay. To do this, we will use the Lightning Process Builder.
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.
- 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 list of a TaskRay Task to Prioritized with Name = Upload Lease.
- 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__c] Name
- Operator = Equals
- Type = String
- Value = Upload Lease
- Field = [TASKRAY__Project_Task__c] List
- Operator = Equals
- Type = Picklist
- Value = Prioritized
- 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 Pending Action record related to the task and the screen flow we created.
- On the canvas under Immediate Actions, click on + Add Action.
- For Action Type, select Create a Record.
- Enter the Action Name.
- For Record Type, select TaskRay Pending Action
- Configure the field values
- Flow Name
- Field = Flow Name
- Type = String
- Value = Upload_Lease
- (the unique name of the flow we created)
- Flow Label
- Field = Flow Label
- Type = String
- Value = Upload Lease
- Owner ID
- Field = Owner ID
- Type = Field Reference
- Value = [TASKRAY__Project_Task__c].OwnerId
- Interview Date
- Field = Interview Date
- Type = Formula
- Value = TODAY()
- TaskRay Task
- Field = TaskRay Task
- Type = Field Reference
- Value = [TASKRAY__Project_Task__c].Id
- Click Save
- Flow Name
- Click Activate in the top right corner.
Step 4: Test It Out!
It's time to see how all of this works together. Go to any project with a task named "Upload Lease", move it to the prioritized column, then complete the file upload flow in the TaskRay Today component. You should now see that the attachment you uploaded is attached to the Task and the Task has moved to the finished column.