Summary
Use the Salesforce Process Builder to add users to a group, aka create memberships, automatically in LearnUpon.
The Salesforce integration is available depending on your LearnUpon plan.
The Salesforce Process Builder allows you to create an automated process with Salesforce records, without writing any code.
This worked example demonstrates how to use an invocable process. You build 2 processes to work together:
- a process that uses Invoke as its process type, as opposed to a record change or a platform event. The process runs whenever you "call" or invoke it, to perform an action
- a process that does the invoking
Once you have an Invoke process active, other processes can use it to perform the same action.
This procedure has 2 parts, 1 for each process. Each process has several steps which are grouped to make them easy to follow.
When each process is complete, select Activate to apply it to your Salesforce data.
Prerequisites
To use Salesforce's Process Builder:
- install the LearnUpon app in your Salesforce organization - see Salesforce: set up LearnUpon and add a tab for all users
- add the LearnUpon API connection to Salesforce - see Salesforce Process Builder: Making automated calls to LearnUpon
Process 1: create the process you invoke from other processes
The invocable process is the one you use and re-use, to generate a known outcome.
In this example: whenever you invoke this process, Salesforce takes the information in the Contact or User record, and adds the user to a group in LearnUpon.
Create a Process in Process Builder
- From Salesforce Home select Setup.
- Use Search to access Process Builder.
The following screenshot shows Setup in Salesforce.
- From the Process Builder, select New, to open a new process.
- Enter a Process Name and Api Name. Optionally, add a description.
- From The process starts when, select one of:
- A record changes
- A platform event message is received
- It's invoked by another process (used in this sample process)
- Save this part of the process.
The following screenshot shows the Process Builder's New Process screen.
Select the Object and define the criteria of executing the actions
- In the process builder, select Add Object.
- In Object, search for the record to use as source for adding a membership, one of:
- Contact for the Contact record
- User for the User record
- Save to finish this section
- In the process builder, select Add Criteria and define the condition which triggers the action, one of:
- Conditions are met
- Formula evaluates to true
- No criteria - just execute the actions, used in this example
- Save to finish this section of the process.
The following screenshot shows Criteria entry of No criteria just execute the actions and decision tree.
Set the process action of adding a user to a group
- In the process builder, select Add action to what happens when the criteria are met: in this case, the action to execute when invoked.
- From Action Type, select Apex and enter a name for the action.
- From Apex Class, select an action: in this example, enter create and select Create Group Membership in LearnUpon.
- After selecting the Apex class, fill in the values for the apex variables. Make sure to add the subdomain of your portal and the LearnUpon group ID correctly. Salesforce sends these variables to the portal via API, and adds the user to the group you specified.
- Save to finish the process.
The following screenshot shows the Add Action entries and decision tree.
Process 2: create the process that invokes
As before, you create a process, and its action invokes the first process of adding a user to a group.
In this second process:
- the process type is a record change
- the Object is the Contact record as the Object
- the Conditions are a string in the Contact record
- the Action is to direct the same contact record to the invoked process - the process that adds a user to a group
- From Salesforce Home select Setup.
- Use Search to access Process Builder.
- From the Process Builder, select New, to open a new process.
- Enter a Process Name and Api Name. Optionally, add a description.
- From The process starts when, select one of:
- A record changes (used in this sample process)
- A platform event message is received
- It's invoked by another process
- Save this part of the process.
- In the process builder, select Add Object.
- In Object, search for the record to use as source for the invite, one of:
- Contact for the Contact record (used in this example)
- User for the User record
- Save to finish this section.
- In the process builder, select Add Criteria and define the condition which triggers the action, one of:
- Conditions are met (used in this example)
- Formula evaluates to true
- No criteria - just execute the actions
- Save to finish this section of the process.
The following screenshot shows the Add Criteria entries and decision tree.
Set the process action of invoking the "create a group membership" process
- In the process builder, select Add action to define the action that happens when the criteria are met.
- From Action Type, select Processes and enter a name for the action.
- From Processes, select an action: enter the name of the invocable process.
- After selecting the Process, fill in the values for the process variables. This example uses the default variable Select the Contact record that started your process.
Salesforce sends the variables specified in the invocable process to the portal via API, and triggers and creates a group membership.
The following screenshot shows the Contact record option.
- Save to finish the process.
The following screenshot shows the Add Action entries and decision tree.
When the process is complete, select Activate to apply it to your Salesforce data.
To view the process from the start, return to Salesforce Home, and access Process Builder from the beginning.
Confirm the user is now part of the group in LearnUpon
To check if the process is adding users to groups:
- From your portal's main navigation go to Groups > group name.
- From secondary navigation select Users to view members of the group.
See: