Automatically Assign Workflows to Employees
Salesforce invocable methods and the Salesforce Flow Builder allow you to create your own automated processes in flair. In this article, we’ll explain how you can automatically assign a flair workflow to colleagues who join a new team in your organization.
flair workflows are a great way to organize and streamline recurring tasks, such as onboarding. By creating a workflow template and assigning it to an employee, you can help ensure that tasks get completed in a consistent manner.
For example, when someone joins your HR team, you may want to assign them a workflow including tasks such as getting to know their team leader, watching an onboarding presentation, and handling their first support ticket. We will use this example to show you how you can automatically assign these tasks to new starters.
First of all, use the flair HR app to create a workflow template for newcomers to your HR team. Next, make sure you have created your team in the Teams section of the app. Click on the team to find and copy the team ID as you will need this later. The ID is the alphanumeric code between c/ and /view in your address bar.
Now open Salesforce Setup and select Flows from the navigation bar on the left. Click New Flow to open the Flow Builder. Select Record-Triggered Flow and click Create.
Enter Team Member into the Object field and select “Trigger the flow when a record is created”.
In the Condition Requirements dropdown, select All Conditions Are Met (AND) and enter the following conditions:
Field: flair__Team__c
Operator: Equals
Value: This should be the ID of the team you want to assign workflows to, which you copied from the Teams page earlier. For example, a2X7S000006kWN9UAM
.
Now click Done to create the Flow.
In the Flow Builder, open the Toolbox by clicking the Toggle Toolbox button in the top-left corner of the navigation bar. Then click New Resource.
Fill in the fields as follows:
Resource Type:Variable
API Name: employeeIds
Description: (Optional)
Data Type: Text
Check the “Allow multiple values (collection)” box and click Done.
Now click the circle between the Start and End of the flow to add an Assignment.
Fill in the fields as follows:
Label: Add Id to Employee Id
Variable: {!employeeIds}
Operator: Add
Value: $Record > flair__Employee__r > Id}
Now click Done.
Now click the circle between your Assignment and the End of the Flow to add an Action.
In the Action search bar, find and select Create Workflow From Template. Then fill out the remaining fields as follows:
Label: Assign workflow
API Name: Assign_workflow
Employee IDs: {!employeeIds}
In the Template Id field, enter the ID of the workflow you want to assign. You can find this by opening the Workflow in your flair HR app and copying the part of the URL between /c and /view and then click Done.
Lastly, click Save in the Flow Builder and give your Flow a Flow Label, such as “Auto-assign workflow for HR team members” and then Save. Click the Activate button to start this flow.
Now, whenever you add a new team member to your HR team, the HR onboarding workflow will automatically be assigned to them.
Updated about 1 year ago