No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
UserProvisioningPlugin Class
Namespace
Usage
Extending this class gives you a plugin that can be used in the Flow designer as an Apex plugin, with the following input and output parameters.
| Input Parameter Name | Description |
|---|---|
| userProvisioningRequestId | The unique ID of the request for the plugin to process. |
| userId | The ID of the associated user for the request. |
| NamedCredDevName | The unique API name for the named credential to use for a request.
The named credential identifies the third-party system and authentication
settings. When the Named Credential is set in the User Provisioning Wizard, Salesforce updates the value for all plugins associated with the current flow. |
| reconFilter | When collecting and analyzing users on a third-party system, the
plugin uses this filter to limit the scope of the collection. When the filter is set in the User Provisioning Wizard, Salesforce updates the value for all plugins associated with the current flow. |
| reconOffset | When collecting and analyzing users on a third-party system, the plugin uses this value as the starting point for the collection. |
| Output Parameter Name | Description |
|---|---|
| Status |
The vendor-specific status of the provisioning operation on the third-party system. |
| Details | The vendor-specific message related to the status of the provisioning operation on the third-party system. |
| ExternalUserId | The vendor-specific ID for the associated user on the third-party system. |
| ExternalUsername | The vendor-specific username for the associated user on the third-party system. |
| ExternalEmail | The email address assigned to the user on the third-party system. |
| ExternalFirstName | The first name assigned to the user on the third-party system. |
| ExternalLastName | The last name assigned to the user on the third-party system. |
| reconState | The state of the collecting and analyzing process on the third-party system. When the value is complete, the process is finished and a subsequent call to the plugin is no longer needed, nor made. |
| nextReconOffset | When collecting and analyzing users on a third-party system, the process may encounter a transaction limit and have to stop before finishing. The value specified here initiates a call to the plugin with a new quota limit. |
Add more custom parameters using the buildDescribeCall() method.
Example
The following example uses the buildDescribeCall() method to add a new input parameter and a new output parameter. The example also demonstrates how to bypass the limit of the 10,000 records processed in DML statements in an Apex transaction.
1global class SampleConnector extends UserProvisioning.UserProvisioningPlugin {
2
3 // Example of adding more input and output parameters to those defined in the base class
4 global override Process.PluginDescribeResult buildDescribeCall() {
5 Process.PluginDescribeResult describeResult = new Process.PluginDescribeResult();
6 describeResult.inputParameters = new
7 List<Process.PluginDescribeResult.InputParameter>{
8 new Process.PluginDescribeResult.InputParameter('testInputParam',
9 Process.PluginDescribeResult.ParameterType.STRING, false)
10 };
11
12 describeResult.outputParameters = new
13 List<Process.PluginDescribeResult.OutputParameter>{
14 new Process.PluginDescribeResult.OutputParameter('testOutputParam',
15 Process.PluginDescribeResult.ParameterType.STRING)
16 };
17
18 return describeResult;
19 }
20
21 // Example Plugin that demonstrates how to leverage the reconOffset/nextReconOffset/reconState
22 // parameters to create more than 10,000 users. (i.e. go beyond the 10,000 DML limit per transaction)
23
24 global override Process.PluginResult invoke(Process.PluginRequest request) {
25 Map<String,String> result = new Map<String,String>();
26 String uprId = (String) request.inputParameters.get('userProvisioningRequestId');
27 UserProvisioning.UserProvisioningLog.log(uprId, 'Inserting Log from test Apex connector');
28 UserProvisioningRequest upr = [SELECT id, operation, connectedAppId, state
29 FROM userprovisioningrequest WHERE id = :uprId];
30 if (upr.operation.equals('Reconcile')) {
31 String reconOffsetStr = (String) request.inputParameters.get('reconOffset');
32 Integer reconOffset = 0;
33 if (reconOffsetStr != null) {
34 reconOffset = Integer.valueOf(reconOffsetStr);
35 }
36
37 if (reconOffset > 44999) {
38 result.put('reconState', 'Completed');
39 }
40
41 Integer i = 0;
42 List<UserProvAccountStaging> upasList = new List<UserProvAccountStaging>();
43 for (i = 0; i < 5000; i++) {
44 UserProvAccountStaging upas = new UserProvAccountStaging();
45 upas.Name = i + reconOffset + '';
46 upas.ExternalFirstName = upas.Name;
47 upas.ExternalEmail = 'externaluser@externalsystem.com';
48 upas.LinkState = 'Orphaned';
49 upas.Status = 'Active';
50 upas.connectedAppId = upr.connectedAppId;
51 upasList.add(upas);
52 }
53 insert upasList;
54 result.put('nextReconOffset', reconOffset + 5000 + '');
55 }
56
57 return new Process.PluginResult(result);
58 }
59}UserProvisioningPlugin Methods
The following are methods for UserProvisioningPlugin.
invoke(Process.PluginRequest)
Signature
public Process.PluginResult invoke(Process.PluginRequest request)
Parameters
- request
- Type: Process.PluginRequest