Account Delete
| Input/Output | Data Type |
|---|---|
| Input | StdAccountDeleteInput |
| Output | StdAccountDeleteOutput |
Example StdAccountDeleteInput
{
"identity": "john.doe",
"key": {
"simple": {
"id": "john.doe"
}
}
}
Example StdAccountDeleteOutput
{
}
Description
The account delete command sends the account's key from ISC, which your connector uses to permanently remove the account from the source system.
Although SaaS Connectivity supports the std:account:delete command, ISC does not send it automatically during normal leaver lifecycle events. ISC sends the std:account:disable command during standard offboarding. Account delete must be triggered explicitly by a BeforeProvisioning rule. For more information, see the documentation and an example implementation. If you want to permanently remove accounts on leaver events, implement that logic in your Account Disable handler instead.
To use this command, you must specify this value in the commands array: std:account:delete
Implementation
The following example shows how to look up the account by its native ID and call the source API to delete it:
import {
ConnectorError,
ConnectorErrorType,
Context,
Response,
StdAccountDeleteInput,
StdAccountDeleteOutput,
} from '@sailpoint/connector-sdk'
.stdAccountDelete(async (context: Context, input: StdAccountDeleteInput, res: Response<StdAccountDeleteOutput>) => {
const id = input.key.simple?.id ?? input.identity
// Confirm the account exists before attempting to delete
const account = await myClient.getAccount(id)
if (!account) {
throw new ConnectorError('Account not found', ConnectorErrorType.NotFound)
}
await myClient.deleteAccount(account.id)
// Return an empty object — account delete has no output payload
res.send({})
})
If your source does not support hard deletes but you need to remove access, you can implement a soft delete instead:
.stdAccountDelete(async (context: Context, input: StdAccountDeleteInput, res: Response<StdAccountDeleteOutput>) => {
// Soft delete: disable the account rather than permanently removing it
await myClient.disableAccount(input.identity)
res.send({})
})
The following snippet shows an equivalent implementation using the Airtable example connector:
.stdAccountDelete(async (context: Context, input: StdAccountDeleteInput, res: Response<StdAccountDeleteOutput>) => {
const account = await airtable.getAccount(input.key)
res.send(await airtable.deleteAccount(account.airtableId))
})
async deleteAccount(airTableid: string): Promise<Record<string, never>> {
return this.airTableBase('Users').destroy(airTableid,
).then(() => {
return {}
}).catch(err => {
throw new ConnectorError('error while deleting account: ' + err)
})
}