Workflow - Compare String 'Contains' does not work

If you only need to determine if an identity has an access profile that starts with “Test-Access”, then I might have a solution for you. Rather than using Get Access, you can use the HTTP Request action to run a search based on your criteria. The request body will be as follows, but you might have to change the path to the identity ID based on your trigger.

{
    "query": {
        "query": "id:{{$.trigger.identity.id}} && @access(type:ACCESS_PROFILE && name:\"Test-Access*\")"
    },
    "indices": [
        "identities"
    ]
}

If the identity you specify has an access profile with a name that starts with Test-Access, then the response body will contain an array with one result. If the identity doesn’t match, then the array will be empty. You can use this in your comparison step to see if there is one element in the array. If true, then you have a match. If false, then no match.

Here’s the workflow script for your reference:

{
	"name": "HTTP Test",
	"description": "",
	"modified": "2022-11-30T14:53:46.979547667Z",
	"definition": {
		"start": "HTTP Request",
		"steps": {
			"HTTP Request": {
				"actionId": "sp:http",
				"attributes": {
					"authenticationType": "OAuth",
					"jsonRequestBody": "{\n    \"query\": {\n        \"query\": \"id:{{$.trigger.identity.id}} && @access(type:ACCESS_PROFILE && name:airtable-*)\"\n    },\n    \"indices\": [\n        \"identities\"\n    ]\n}",
					"method": "post",
					"oAuthClientId": "***",
					"oAuthClientSecret": "***",
					"oAuthCredentialLocation": "oAuthInHeader",
					"oAuthTokenUrl": "https://your-tenant.api.identitynow.com/oauth/token",
					"requestContentType": "json",
					"url": "https://your-tenant.api.identitynow.com/v3/search",
					"urlParams": null
				},
				"nextStep": "Verify Data Type",
				"type": "action",
				"versionNumber": 2
			},
			"Verify Data Type": {
				"choiceList": [
					{
						"comparator": "IsPresent",
						"nextStep": "success",
						"variableA.$": "$.hTTPRequest.body[0]"
					}
				],
				"defaultStep": "failure",
				"type": "choice"
			},
			"failure": {
				"failureName": "Fail",
				"type": "failure"
			},
			"success": {
				"type": "success"
			}
		}
	},
	"creator": {
		"type": "IDENTITY",
		"id": "2c9180867624cbd7017642d8c8c81f67",
		"name": "colin.mckibben"
	},
	"trigger": {
		"type": "EVENT",
		"attributes": {
			"id": "idn:identity-created"
		}
	}
}
1 Like