Hello!!
{
"name": "Change Role Owner And Gov Members",
"description": "Change Role Owner",
"modified": "2025-06-24T13:22:33.666047122Z",
"modifiedBy": {
"type": "IDENTITY",
"id": "12321312",
"name": "user"
},
"definition": {
"start": "Get Identity",
"steps": {
"Compare Numbers": {
"actionId": "sp:compare-numbers",
"choiceList": [
{
"comparator": "NumericGreaterThanEquals",
"nextStep": "Compare Strings",
"variableA.$": "$.hTTPRequest.body.length()",
"variableB": 1
}
],
"defaultStep": "Compare Numbers 1",
"displayName": "Check if user is Owner of any role",
"type": "choice"
},
"Compare Numbers 1": {
"actionId": "sp:compare-numbers",
"choiceList": [
{
"comparator": "NumericGreaterThanEquals",
"nextStep": "Compare Strings 1",
"variableA.$": "$.hTTPRequest2.body.length()",
"variableB": 1
}
],
"defaultStep": "End Step - Success",
"displayName": "Check if the user belongs to any group",
"type": "choice"
},
"Compare Strings": {
"actionId": "sp:compare-strings",
"choiceList": [
{
"comparator": "StringContains",
"nextStep": "Send Email 1",
"variableA.$": "$.getIdentity1.attributes.title",
"variableB": "SUPERINTENDENTE"
}
],
"defaultStep": "Loop",
"displayName": "Check if the User LM is SuperIntendente",
"type": "choice"
},
"Compare Strings 1": {
"actionId": "sp:compare-strings",
"choiceList": [
{
"comparator": "StringContains",
"nextStep": "Send Email 2",
"variableA.$": "$.getIdentity1.attributes.title",
"variableB": "SUPERINTENDENTE"
}
],
"defaultStep": "Loop 1",
"displayName": "Check if the User LM is SuperIntendente",
"type": "choice"
},
"End Step - Success": {
"actionId": "sp:operator-success",
"displayName": "",
"type": "success"
},
"End Step - Success 4": {
"actionId": "sp:operator-success",
"displayName": "",
"type": "success"
},
"Get Identity": {
"actionId": "sp:get-identity",
"attributes": {
"id.$": "$.trigger.identity.id"
},
"displayName": "",
"nextStep": "Get Identity 1",
"type": "action",
"versionNumber": 2
},
"Get Identity 1": {
"actionId": "sp:get-identity",
"attributes": {
"id.$": "$.trigger.changes[?(@.attribute == 'manager')].oldValue.id"
},
"displayName": "Get Manager Identity",
"nextStep": "HTTP Request 2",
"type": "action",
"versionNumber": 2
},
"HTTP Request": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"method": "get",
"oAuthClientId": "asdasdas",
"oAuthClientSecret": "$.secrets.asdasdas",
"oAuthCredentialLocation": "oAuthInBody",
"oAuthTokenUrl": "https://my-tenant.api.identitynow.com/oauth/token",
"url": "https://my-tenant.api.identitynow.com/beta/roles",
"urlParams": {
"filters": "owner.id eq \"{{$.trigger.identity.id}}\""
}
},
"displayName": "Get Roles that the user owns",
"nextStep": "Compare Numbers",
"type": "action",
"versionNumber": 2
},
"HTTP Request 2": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"method": "get",
"oAuthClientId": "asdasdas",
"oAuthClientSecret": "$.secrets.12312321",
"oAuthCredentialLocation": "oAuthInBody",
"oAuthTokenUrl": "https://my-tenant.api.identitynow.com/oauth/token",
"url": "https://my-tenant.api.identitynow.com/beta/workgroups",
"urlParams": {
"filters": "memberships.identityId eq \"{{$.trigger.identity.id}}\""
}
},
"displayName": "Get gov group membership",
"nextStep": "HTTP Request",
"type": "action",
"versionNumber": 2
},
"Loop": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.getIdentity1",
"input.$": "$.hTTPRequest.body",
"start": "HTTP Request 1",
"steps": {
"End Step - Success 1": {
"actionId": "sp:operator-success",
"displayName": "",
"type": "success"
},
"HTTP Request 1": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"basicAuthPassword": "$.secrets.123123231321",
"basicAuthUserName": "user",
"jsonPatchRequestBody": [
{
"op": "add",
"path": "/owner",
"value": {
"id": "{{$.loop.context.id}}",
"type": "IDENTITY"
}
}
],
"jsonRequestBody": [
{
"op": "add",
"path": "/owner",
"value": {
"id": "ebeb6ba2f5124543a2090639525eea7",
"type": "IDENTITY"
}
}
],
"method": "patch",
"oAuthClientId": "asdasdas",
"oAuthClientSecret": "$.secrets.asdasdas1231231",
"oAuthCredentialLocation": "oAuthInBody",
"oAuthTokenUrl": "https://my-tenant.api.identitynow.com/oauth/token",
"requestContentType": "json-patch+json",
"url": "https://my-tenant.api.identitynow.com/beta/roles/{{$.loop.loopInput.id}}",
"urlParams": null
},
"displayName": "Change role owner",
"nextStep": "End Step - Success 1",
"type": "action",
"versionNumber": 2
}
}
},
"displayName": "Add LM as Owner",
"nextStep": "Send Email",
"type": "action",
"versionNumber": 1
},
"Loop 1": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.getIdentity1",
"input.$": "$.hTTPRequest2.body",
"start": "HTTP Request 3",
"steps": {
"End Step - Success 3": {
"actionId": "sp:operator-success",
"displayName": "",
"type": "success"
},
"HTTP Request 3": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"basicAuthPassword": "$.secrets.123123213",
"basicAuthUserName": "user",
"jsonPatchRequestBody.$": "",
"jsonRequestBody": [
[
{
"id": "{{$.loop.context.id}}",
"type": "IDENTITY"
}
]
],
"method": "post",
"oAuthClientId": "asdasdas",
"oAuthClientSecret": "$.secrets.asdasdas1231231",
"oAuthCredentialLocation": "oAuthInBody",
"oAuthTokenUrl": "https://my-tenant.api.identitynow.com/oauth/token",
"requestContentType": "json",
"requestHeaders": {
"Accept": "application/json",
"Content-Type": "application/json"
},
"url": "https://my-tenant.api.identitynow.com/beta/workgroups/{{$.loop.loopInput.id}}/members/bulk-add",
"urlParams": null
},
"displayName": "Add LM to Gov Group",
"nextStep": "End Step - Success 3",
"type": "action",
"versionNumber": 2
}
}
},
"displayName": "Add LM as Group Member",
"nextStep": "Loop 2",
"type": "action",
"versionNumber": 1
},
"Loop 2": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.getIdentity",
"input.$": "$.hTTPRequest2.body",
"start": "HTTP Request 4",
"steps": {
"End Step - Success 2": {
"actionId": "sp:operator-success",
"displayName": "",
"type": "success"
},
"HTTP Request 4": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"basicAuthPassword": "$.secrets.123123213",
"basicAuthUserName": "user",
"jsonPatchRequestBody.$": "",
"jsonRequestBody": [
[
{
"id": "{{$.loop.context.id}}",
"type": "IDENTITY"
}
]
],
"method": "post",
"oAuthClientId": "asdasdas",
"oAuthClientSecret": "$.secrets.asdasdas1231231",
"oAuthCredentialLocation": "oAuthInBody",
"oAuthTokenUrl": "https://my-tenant.api.identitynow.com/oauth/token",
"requestContentType": "json",
"requestHeaders": {
"Accept": "application/json",
"Content-Type": "application/json"
},
"url": "https://my-tenant.api.identitynow.com/beta/workgroups/{{$.loop.loopInput.id}}/members/bulk-delete",
"urlParams": null
},
"displayName": "",
"nextStep": "End Step - Success 2",
"type": "action",
"versionNumber": 2
}
}
},
"displayName": "Remove User from Groups",
"nextStep": "Send Email 3",
"type": "action",
"versionNumber": 1
},
"Send Email": {
"actionId": "sp:send-email",
"attributes": {
"body": "emailBody",
"context": {
"LmImediato.$": "$.getIdentity1.attributes.displayName",
"roles.$": "$.hTTPRequest.body",
"today.$": "$.now()",
"userName.$": "$.getIdentity.attributes.displayName"
},
"recipientEmailList": [
"yan.coelho@domai.com"
],
"subject": "Notificação - Mudança de custódia de Role - Desligamento ${userName}"
},
"displayName": "Notify Changes",
"nextStep": "Compare Numbers 1",
"type": "action",
"versionNumber": 2
},
"Send Email 1": {
"actionId": "sp:send-email",
"attributes": {
"body": "emailBody",
"context": {
"roles.$": "$.hTTPRequest.body",
"userName.$": "$.getIdentity.attributes.displayName"
},
"recipientEmailList": [
"yan.coelho@domai.com"
],
"subject": "Notificação - Mudança de custódia de Role - Desligamento ${userName}"
},
"description": null,
"displayName": "Notify ADMs to change manually",
"nextStep": "Compare Numbers 1",
"type": "action",
"versionNumber": 2
},
"Send Email 2": {
"actionId": "sp:send-email",
"attributes": {
"body": "emailBody",
"context": {
"groups.$": "$.hTTPRequest2.body",
"userName.$": "$.getIdentity.attributes.displayName"
},
"recipientEmailList": [
"yan.coelho@domai.com"
],
"subject": "Notificação - Mudança de custódia de Role - Desligamento ${userName}"
},
"description": null,
"displayName": "Notify ADMs to change manually",
"nextStep": "End Step - Success 4",
"type": "action",
"versionNumber": 2
},
"Send Email 3": {
"actionId": "sp:send-email",
"attributes": {
"body": "emailBody",
"context": {
"LmImediato.$": "$.getIdentity1.attributes.displayName",
"groups.$": "$.hTTPRequest2.body",
"today.$": "$.now()",
"userName.$": "$.getIdentity.attributes.displayName"
},
"recipientEmailList": [
"yan.coelho@domai.com"
],
"subject": "Notificação - Mudança de custódia de Role - Desligamento ${userName}"
},
"displayName": "Notify Gov Group Changes",
"nextStep": "End Step - Success 4",
"type": "action",
"versionNumber": 2
}
}
},
"creator": {
"type": "IDENTITY",
"id": "39c744461eaf411381717786aa18fc08",
"name": "user"
},
"trigger": {
"type": "EVENT",
"attributes": {
"filter.$": "$.changes[?(@.attribute == \"cloudLifecycleState\" && (@.newValue == \"inactive\"))]",
"id": "idn:identity-attributes-changed"
}
}
}
In the UI you should put a list like this [[…]], always two brackets if in the body is just one item in the list.