Loading
Salesforce now sends email only from verified domains. Read More
Identify Your Users and Manage Access
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Examples: Deactivate and Reactivate Users with SCIM

          Examples: Deactivate and Reactivate Users with SCIM

          In Salesforce, you deactivate user objects rather than deleting them. By deactivating a user object, the user’s active status becomes false. Even though you can still query the user object, the user can’t log in to Salesforce with the deactivated account. To allow a user to log in, you can reactivate their account.

          Required Editions

          Available in: Salesforce Classic and Lightning Experience
          Available in: All Editions

          To see how to deactivate and reactivate user accounts, view the following examples.

          Deactivate a User with PATCH

          To deactivate a user, send a PATCH request to the Users endpoint, as shown in this example.

          Request:

          PATCH https://mycompany.my.salesforce.com/services/scim/v2/Users/<user_Id>
          
          {
            "schemas": [
              "urn:ietf:params:scim:api:messages:2.0:PatchOp"
            ],
            "Operations": [
              {
                "op": "replace",
                "value": {
                  "active": false
                }
              }
            ]
          }

          Response:

          HTTP/1.1 200 OK
          …
          
          {
            "schemas": [
              "urn:ietf:params:scim:schemas:core:2.0:User",
              "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
            ],
            "id": "0054W00000...",
            "userName": "scimuser@mycompany.com",
            "externalId": "scimUser",
            "name": {
              "formatted": "User Scim",
              "familyName": "Scim",
              "givenName": "User"
            },
            "displayName": "User Scim",
            "nickName": "user2",
            "emails": [
              {
                "type": "work",
                "primary": true,
                "value": "user@mycompany.com"
              }
          ...  
          
            "meta": {
              "created": "2020-10-22T06:21:45Z",
              "lastModified": "2020-10-25T09:21:43Z",
              "location": "https://mycompany.my.salesforce.com/services/scim/v2/Users/0054W000...",
              "resourceType": "User",
              "version": "6a91c1386738961d6b223b2c6ef860715f2ab155"
            }
          }
          

          Deactivate a User with DELETE

          You can also deactivate a user with a DELETE request, as shown here. The result is the same as deactivating a user with a PATCH request. The user object’s active status is updated to false. In this example, notice that the response code only includes an HTTP code. This code indicates that the request is successful.

          Request:

          DELETE https://mycompany.my.salesforce.com/services/scim/v2/Users/<user_id>

          Response:

          HTTP/1.1 204 No Content

          Reactivate a User

          You can reactivate a user object by sending a PATCH request to the Users endpoint. Here’s an example request.

          Request:

          PATCH https://mycompany.my.salesforce.com/services/scim/v2/Users/<user_id>
          
          {
            "schemas": [
              "urn:ietf:params:scim:api:messages:2.0:PatchOp"
            ],
            "Operations": [
              {
                "op": "replace",
                "value": {
                  "active": true
                }
              }
            ]
          }

          Response:

          HTTP/1.1 200 OK
          …
          
          {
            "schemas": [
              "urn:ietf:params:scim:schemas:core:2.0:User",
              "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
            ],
            "id": "0054W00000CVREkQAP",
            "userName": "scimuser@mycompany.com",
            "externalId": "scimUser",
            "name": {
              "formatted": "User Scim",
              "familyName": "Scim",
              "givenName": "User"
            },
            "displayName": "User Scim",
            "nickName": "user2",
            "emails": [
              {
                "type": "work",
                "primary": true,
                "value": "user@mycompany.com"
              }
            ...
          
            "meta": {
              "created": "2020-10-22T06:21:45Z",
              "lastModified": "2020-10-25T15:18:57Z",
              "location": "https://mycompany.my.salesforce.com/services/scim/v2/Users/0054W00000CVREkQAP",
              "resourceType": "User",
              "version": "b5f45d87e1a39af1f10ef8d16fd7f61a30c171ed"
            }
          }
          
           
          Loading
          Salesforce Help | Article