---
schema_version: "1"
id: e9dbc70bb92201074d8a32baa09ec02d5e93b27ef7b69f36708c4ebf0413af96
title: UserProvisioningPlugin Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 936bc67b64bf2bdf357ab348384c6af07b1c3b049708ac18e3cee81761889b56
description: The UserProvisioningPlugin base class implements Process.Plugin for programmatic customization of the user provisioning process for connected apps. Use this method to add more input and output parameters to those defined in the base class.Returns a Process.PluginDescribeResult object that describes this method call.Returns the name of the class implementing the plugin.Primary method that the system invokes when the class that implements the interface is instantiated.
---
# UserProvisioningPlugin Class

The UserProvisioningPlugin base class implements Process.Plugin for programmatic customization of the user provisioning process for connected apps.

## Namespace

[UserProvisioning](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_UserProvisioning.htm "The UserProvisioning namespace provides methods for monitoring outbound user provisioning requests.")

## Usage

Extending this class gives you a plug-in that can be used Flow Builder as a legacy Apex action, with the following input and output parameters.

<table class="featureTable sort_table" summary="">


            <thead class="thead sorted" align="left">
              <tr>
                <th class="featureTableHeader  text-center" id="d1793589e78">Input Parameter Name</th>

                <th class="featureTableHeader vertical-align-top text-center" id="d1793589e81">Description</th>

              </tr>

            </thead>

            <tbody class="tbody">
              <tr>
                <td class=" text-left" headers="d1793589e78" data-title="Input Parameter Name"><samp class="codeph nolang">userProvisioningRequestId</samp></td>

                <td class=" text-left" headers="d1793589e81" data-title="Description">The unique ID of the request for the plug-in to process.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e78" data-title="Input Parameter Name"><samp class="codeph nolang">userId</samp></td>

                <td class=" text-left" headers="d1793589e81" data-title="Description">The ID of the associated user for the request.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e78" data-title="Input Parameter Name"><samp class="codeph nolang">NamedCredDevName</samp></td>

                <td class=" text-left" headers="d1793589e81" data-title="Description">The unique API name for the named credential to use for a request.
                  The named credential identifies the third-party system and the third-party
                  authentication settings.<p class="p">When the named credential is set in the User Provisioning
                    Wizard, Salesforce stores the value in the
                    <span class="keyword parmname">UserProvisioningConfig.NamedCredentialId</span> field.
                  </p>
                </td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e78" data-title="Input Parameter Name"><samp class="codeph nolang">reconFilter</samp></td>

                <td class=" text-left" headers="d1793589e81" data-title="Description">When collecting and analyzing users on a third-party system, the
                  plug-in uses this filter to limit the scope of the collection.<p class="p">When the filter is
                    set in the User Provisioning Wizard, Salesforce stores the value in the
                    <span class="keyword parmname">UserProvisioningConfig.ReconFilter</span> field.
                  </p>
                </td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e78" data-title="Input Parameter Name"><samp class="codeph nolang">reconOffset</samp></td>

                <td class=" text-left" headers="d1793589e81" data-title="Description">When collecting and analyzing users on a third-party system, the
                  plug-in uses this value as the starting point for the collection.</td>

              </tr>

            </tbody>

          </table>

<table class="featureTable sort_table" summary="">


            <thead class="thead sorted" align="left">
              <tr>
                <th class="featureTableHeader  text-center" id="d1793589e163">Output Parameter Name</th>

                <th class="featureTableHeader vertical-align-top text-center" id="d1793589e166">Description</th>

              </tr>

            </thead>

            <tbody class="tbody">
              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">Status</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">
                  <p class="p">The vendor-specific status of the provisioning operation on the third-party
                    system.</p>

                </td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">Details</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The vendor-specific message related to the status of the
                  provisioning operation on the third-party system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">ExternalUserId</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The vendor-specific ID for the associated user on the third-party
                  system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">ExternalUsername</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The vendor-specific username for the associated user on the
                  third-party system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">ExternalEmail</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The email address assigned to the user on the third-party
                  system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">ExternalFirstName</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The first name assigned to the user on the third-party
                  system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">ExternalLastName</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The last name assigned to the user on the third-party
                  system.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">reconState</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">The state of the collecting and analyzing process on the
                  third-party system. When the value is <samp class="codeph nolang">complete</samp>,
                  the process is finished and a subsequent call to the plug-in is no longer needed,
                  nor made.</td>

              </tr>

              <tr>
                <td class=" text-left" headers="d1793589e163" data-title="Output Parameter Name"><samp class="codeph nolang">nextReconOffset</samp></td>

                <td class=" text-left" headers="d1793589e166" data-title="Description">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 plug-in with a new quota limit.</td>

              </tr>

            </tbody>

          </table>

If you want to add more custom parameters, use 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.

global with sharing class SampleConnector extends UserProvisioning.UserProvisioningPlugin {

    // Example of adding more input and output parameters to those defined in the base class
    global override Process.PluginDescribeResult buildDescribeCall() { 
        Process.PluginDescribeResult describeResult = new Process.PluginDescribeResult();
        describeResult.inputParameters = new 
            List<Process.PluginDescribeResult.InputParameter>{ 
               new Process.PluginDescribeResult.InputParameter('testInputParam', 
                       Process.PluginDescribeResult.ParameterType.STRING, false)
            }; 

        describeResult.outputParameters = new 
            List<Process.PluginDescribeResult.OutputParameter>{ 
               new Process.PluginDescribeResult.OutputParameter('testOutputParam', 
                       Process.PluginDescribeResult.ParameterType.STRING)
            };
            
        return describeResult;
    }
    
    // Example Plugin that demonstrates how to leverage the reconOffset/nextReconOffset/reconState
    // parameters to create more than 10,000 users. (i.e. go beyond the 10,000 DML limit per transaction)
    
    global override Process.PluginResult invoke(Process.PluginRequest request) {
        Map<String,String\> result = new Map<String,String\>();
        String uprId = (String) request.inputParameters.get('userProvisioningRequestId');
        UserProvisioning.UserProvisioningLog.log(uprId, 'Inserting Log from test Apex connector');
        UserProvisioningRequest upr = \[SELECT id, operation, connectedAppId, state
                   FROM userprovisioningrequest WHERE id = :uprId WITH USER\_MODE\];
        if (upr.operation.equals('Reconcile')) {
            String reconOffsetStr = (String) request.inputParameters.get('reconOffset');
            Integer reconOffset = 0;
            if (reconOffsetStr != null) {
                reconOffset = Integer.valueOf(reconOffsetStr);
            }
            
            if (reconOffset > 44999) {
                result.put('reconState', 'Completed');
            }
            
            Integer i = 0;
            List<UserProvAccountStaging> upasList = new List<UserProvAccountStaging>();
            for (i = 0; i < 5000; i++) {
                UserProvAccountStaging upas = new UserProvAccountStaging();
                upas.ExternalUserId = i + reconOffset + '';
                upas.ExternalFirstName = upas.ExternalUserId;
                upas.ExternalEmail = 'externaluser@externalsystem.com';
                upas.LinkState = 'Orphaned';
                upas.Status = 'Active';
                upas.connectedAppId = upr.connectedAppId;
                upasList.add(upas);
            }
            insert as user upasList;
            result.put('nextReconOffset', reconOffset + 5000 + '');
        }
        
        return new Process.PluginResult(result);
    }
}
    

- **[UserProvisioningPlugin Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm#apex_UserProvisioning_UserProvisioningPlugin_methods)**

## UserProvisioningPlugin Methods

The following are methods for UserProvisioningPlugin.

- **[buildDescribeCall()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm#apex_UserProvisioning_UserProvisioningPlugin_buildDescribeCall)**  
    Use this method to add more input and output parameters to those defined in the base class.
- **[describe()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm#apex_UserProvisioning_UserProvisioningPlugin_describe)**  
    Returns a Process.PluginDescribeResult object that describes this method call.
- **[getPluginClassName()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm#apex_UserProvisioning_UserProvisioningPlugin_getPluginClassName)**  
    Returns the name of the class implementing the plugin.
- **[invoke(request)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_UserProvisioning_UserProvisioningPlugin.htm#apex_UserProvisioning_UserProvisioningPlugin_invoke)**  
    Primary method that the system invokes when the class that implements the interface is instantiated.

### buildDescribeCall()

Use this method to add more input and output parameters to those defined in the base class.

#### Signature

public Process.PluginDescribeResult buildDescribeCall()

#### Return Value

Type: [Process.PluginDescribeResult](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Process_PluginDescribeResult.htm#apex_class_Process_PluginDescribeResult "Describes the input and output parameters for Process.PluginResult.")

### describe()

Returns a Process.PluginDescribeResult object that describes this method call.

#### Signature

public Process.PluginDescribeResult describe()

#### Return Value

Type: [Process.PluginDescribeResult](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Process_PluginDescribeResult.htm#apex_class_Process_PluginDescribeResult "Describes the input and output parameters for Process.PluginResult.")

### getPluginClassName()

Returns the name of the class implementing the plugin.

#### Signature

public String getPluginClassName()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### invoke(request)

Primary method that the system invokes when the class that implements the interface is instantiated.

#### Signature

public Process.PluginResult invoke(Process.PluginRequest request)

#### Parameters

- **request**:
    
    Type: [Process.PluginRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Process_PluginRequest.htm#apex_class_Process_PluginRequest "Passes input parameters from the class that implements the Process.Plugin interface to the flow.")

#### Return Value

Type: [Process.PluginDescribeResult](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Process_PluginDescribeResult.htm#apex_class_Process_PluginDescribeResult "Describes the input and output parameters for Process.PluginResult.")