/
Working with Salesforce Users

This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Salesforce Users



Overview

The following operations allow you to work with users. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with users, see Sample configuration

OperationDescription
getUserInformationRetrieves information about a specific user.
resetPasswordResets the password of a specific user.

Operation details

This section provides further details on the operations related to users.

Retrieving information for a user

To retrieve information about a specific user, use salesforcerest.getUserInformation and specify the following property.

getUserInformation
<salesforcerest.getUserInformation>
    <userId>{$ctx:userId}</userId>
</salesforcerest.getUserInformation>
Properties
  • userId: The ID of the user whose information you want to retrieve.
Sample request

Following is a sample REST request that can be handled by the getUserInformation operation.

Sample request for getUserInformation operation
{
  "accessToken":"00D280000017q6q!AQoAQOeXcp7zKo3gUdy6r064_LsJ5bYYrUn_qAZG9TtKFLPfUMRxiato.E162_2XAtCTZLFQTbNk2Rz6Zm_juSakFE_aaBPp",
  "apiUrl":"https://ap2.salesforce.com",
  "clientId": "3MVG9ZL0ppGP5UrBrnsanGUZRgHqc8gTV4t_6tfuef8Zz4LhFPipmlooU6GBszpplbTzVXXWjqkGHubhRip1s",
  "refreshToken": "5Aep861TSESvWeug_xvFHRBTTbf_YrTWgEyjBJo7Xr34yOQ7GCFUN5DnNPxzDIoGoWi4evqOl_lT1B9nE5dAtSb",
  "clientSecret": "9104967092887676680",
  "hostName": "https://login.salesforce.com",
  "apiVersion": "v32.0",
  "intervalTime" : "100000",
  "userId": "00528000000yl7j",
  "registryPath": "connectors/SalesforceRest"
 }


Resetting the password

To reset the password of a specific user, use salesforcerest.resetPassword and specify the following property.

resetPassword
<salesforcerest.resetPassword>
    <userId>{$ctx:userId}</userId>
</salesforcerest.resetPassword>
Properties
  • userId: The ID of the user.
Sample request

Following is a sample REST request that can be handled by the resetPassword operation.

Sample request for resetPassword operation
{
  "accessToken":"00D280000017q6q!AQoAQOeXcp7zKo3gUdy6r064_LsJ5bYYrUn_qAZG9TtKFLPfUMRxiato.E162_2XAtCTZLFQTbNk2Rz6Zm_juSakFE_aaBPp",
  "apiUrl":"https://ap2.salesforce.com",
  "clientId": "3MVG9ZL0ppGP5UrBrnsanGUZRgHqc8gTV4t_6tfuef8Zz4LhFPipmlooU6GBszpplbTzVXXWjqkGHubhRip1s",
  "refreshToken": "5Aep861TSESvWeug_xvFHRBTTbf_YrTWgEyjBJo7Xr34yOQ7GCFUN5DnNPxzDIoGoWi4evqOl_lT1B9nE5dAtSb",
  "clientSecret": "9104967092887676680",
  "hostName": "https://login.salesforce.com",
  "apiVersion": "v32.0",
  "intervalTime" : "100000",
  "userId": "00528000000yl7j",
  "registryPath": "connectors/SalesforceRest"
 }
Related Salesforce REST Documentation

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_user_password.htm

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_user_password.htm

Sample configuration

Following is a sample proxy service that illustrates how to connect to Salesforce with the init operation and use the resetPassword operation. The sample request for this proxy can be found in the resetPassword sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="resetPassword"
       statistics="disable" trace="disable" transports="https http">
    <target>
        <inSequence>
            <property name="accessToken" expression="json-eval($.accessToken)"/>
            <property name="apiUrl" expression="json-eval($.apiUrl)"/>
            <property name="userId" expression="json-eval($.userId)"/>
            <property name="clientId" expression="json-eval($.clientId)"/>
            <property name="refreshToken" expression="json-eval($.refreshToken)"/>
            <property name="clientSecret" expression="json-eval($.clientSecret)"/>
            <property name="hostName" expression="json-eval($.hostName)"/>
            <property name="apiVersion" expression="json-eval($.apiVersion)"/>
            <property name="registryPath" expression="json-eval($.registryPath)"/>
 			<property name="intervalTime" expression="json-eval($.intervalTime)"/>
            <salesforcerest.init>
                <accessToken>{$ctx:accessToken}</accessToken>
                <apiUrl>{$ctx:apiUrl}</apiUrl>
                <apiVersion>{$ctx:apiVersion}</apiVersion>
                <hostName>{$ctx:hostName}</hostName>
                <clientSecret>{$ctx:clientSecret}</clientSecret>
                <clientId>{$ctx:clientId}</clientId>
                <refreshToken>{$ctx:refreshToken}</refreshToken>
                <registryPath>{$ctx:registryPath}</registryPath>
				<intervalTime>{$ctx:intervalTime}</intervalTime>
            </salesforcerest.init>
            <log category="INFO" level="full" separator=","/>
            <salesforcerest.resetPassword>
                <userId>{$ctx:userId}</userId>
            </salesforcerest.resetPassword>
            <send/>
        </inSequence>
    </target>
</proxy>



Related content