Comma-Separating Array in Workflow for Create-Campaign API

Hi!

I’m trying to create a workflow with an interactive form for managers to trigger a certification campaign manually. The requirements are:

  • Employees of the manager should be added to the campaign only if they are not LCS = terminated.
  • The campaign should only contain Access Profiles and Roles and we need to filter out specific access.

Since the OOTB “Create Certification Campaign” action doesn’t meet these requirements, I plan to use an HTTP request to create the campaign.

The problem: When using the “Get List of Identities” action (via Search Query), the identities are returned in this format:

["979281be06a34fd4byur8541de1ddd7c" "ea8c45928123889b547aca88e89a435" "0eae71b5fe63409reg9ecf2590307e53"]

However, the API call for create-campaign requires a comma-separated array.

I’ve tried using the “Define Variable” operator to modify the array, but haven’t been able to make it work for this use case.

Any tips? Thanks! :blush:

Hi Daniel ! Can you share your create campaign operation config body . If okay, please share your entire workflow json masking the sensitive data

1 Like

Hi @sidharth_tarlapally!

Thank you for the quick reply.

Here is the body of the create campaign (which doesn’t work as is):

{
“autoRevokeAllowed”: true,
“description”: “Description here”,
“deadline”: “2025-04-23T05:50:35.189Z”,
“emailNotificationEnabled”: true,
“name”: “TEST”,
“recommendationsEnabled”: true,
“searchCampaignInfo”: {
“identityIds”: [
$.getListOfIdentities.identities[*].id
],
“indices”: [
“accessprofiles,roles”
],
“query”: “NOT tags:TESTACCESS”,
“reviewer”: {
“id”: {{$.getIdentity.id}},
“type”: “IDENTITY”
},
“type”: “ACCESS”
},
“type”: “SEARCH”
}

Here is the complete workflow json file:

{
“name”: “Certification campaign Manager”,
“description”: “”,
“modified”: “2025-04-09T13:08:38.135854594Z”,
“modifiedBy”: {
“type”: “IDENTITY”,
“id”: “idhere”,
“name”: “firstname.lastname”
},
“definition”: {
“start”: “Interactive Form”,
“steps”: {
“Compare Strings”: {
“choiceList”: [
{
“comparator”: “StringEquals”,
“nextStep”: “Get List of Identities”,
“variableA.$”: “$.interactiveForm.formData.startaUppfoljningskampanj”,
“variableB”: “Ja”
}
],
“defaultStep”: “End Step - Success”,
“displayName”: “”,
“type”: “choice”
},
“End Step - Success”: {
“displayName”: “”,
“type”: “success”
},
“End Step - Success 1”: {
“displayName”: “”,
“type”: “success”
},
“Get Identity”: {
“actionId”: “sp:get-identity”,
“attributes”: {
“id.$”: “$.trigger.launchedBy.id”
},
“description”: null,
“displayName”: “”,
“nextStep”: “Compare Strings”,
“type”: “action”,
“versionNumber”: 2
},
“Get List of Identities”: {
“actionId”: “sp:get-identities”,
“attributes”: {
“inputManagedBy”: null,
“inputManagerOf”: null,
“inputQuery”: “manager.id:{{$.getIdentity.id}} AND !attributes.cloudLifecycleState:terminated”,
“searchBy”: “searchQuery”
},
“displayName”: “”,
“nextStep”: “HTTP Request”,
“type”: “action”,
“versionNumber”: 2
},
“HTTP Request”: {
“actionId”: “sp:http”,
“attributes”: {
“authenticationType”: “OAuth”,
“jsonRequestBody”: “{\n "autoRevokeAllowed": true,\n "description": "Description here",\n "deadline": "2025-04-23T05:50:35.189Z",\n "emailNotificationEnabled": true,\n "name": "TEST",\n "recommendationsEnabled": true,\n "searchCampaignInfo": {\n "identityIds": [\n$.getListOfIdentities.identities[*].id\n ],\n "indices": [\n "accessprofiles,roles"\n ],\n "query": "NOT tags:TESTACCESS",\n "reviewer": {\n "id": {{$.getIdentity.id}},\n "type": "IDENTITY"\n },\n "type": "ACCESS"\n },\n "type": "SEARCH"\n}”,
“method”: “post”,
“oAuthClientId”: “clientidhere”,
“oAuthCredentialLocation”: “oAuthInHeader”,
“oAuthScope”: null,
“oAuthTokenUrl”: “https://tenant.api.identitynow.com/oauth/token”,
“requestContentType”: “json”,
“url”: “https://tenant.api.identitynow.com/v3/campaigns
},
“description”: “Create Certification Campaign”,
“displayName”: “HTTP Request 2”,
“nextStep”: “End Step - Success 1”,
“type”: “action”,
“versionNumber”: 2
},
“Interactive Form”: {
“actionId”: “sp:interactive-form”,
“attributes”: {
“formDefinitionId”: “XXXXXXXX-d718-404e-XXXX-1d78cec4f158”,
“interactiveProcessId.$”: “$.trigger.interactiveProcessId”,
“message”: “”,
“ownerId.$”: “$.trigger.launchedBy.id”,
“title”: “Certification Campaign Manager”
},
“displayName”: “”,
“nextStep”: “Get Identity”,
“type”: “action”,
“versionNumber”: 1
}
}
},
“creator”: {
“type”: “IDENTITY”,
“id”: “idhere”,
“name”: “firstname.lastname”
},
“trigger”: {
“type”: “EVENT”,
“attributes”: {
“filter.$”: “$[?(@.workflowId == ‘XXXXXXXX-1b70-47f2-XXXX-c194ad55992d’)]”,
“id”: “idn:interactive-process-launched”
}
}
}

Daniel…

[provided without escaping json]
replace this line :
"identityIds": $.getListOfIdentities.identities[*].id

with
"identityIds":{{$.getListOfIdentities.identities[*].id.JSON()}}

This should work

Hi again!

Thanks for the input.

I tried with this, but unfortunately getting the error message below.

“identityIds”:{{$.getListOfIdentities.identities[*].id.JSON()}}

ActivityTaskFailed,"2025-04-10T08:03:19.954782242Z","{""displayName"":""HTTP Request 2"",""error"":""Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ':' after array element"",""stepName"":""hTTPRequest"",""task"":""sp:http"",""technicalName"":""HTTP Request""}" WorkflowExecutionFailed,"2025-04-10T08:03:19.984627636Z","{""error"":""task failed: activity error (type: sp:external:http:v2, scheduledEventID: 40, startedEventID: 41, identity: 1@sp-workflow-worker-stg-eu-central-1-7bkty7219d-p12kt@sp-workflow-engine): Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ':' after array element (type: Error Parsing Input, retryable: false): Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ':' after array element (type: SyntaxError, retryable: true)""}"

Is there a way to test and see the output? I tried outputing it to an email like below, but I’m getting the same output as previously, separated with spaces. Perhaps the curly braces are necessary (which does not look supported in the send email action)

$.getListOfIdentities.identities[*].id.JSON()

Appreciate the help :slight_smile:

To use this variable in the send email , use curly braces :
{{$.getListOfIdentities.identities[*].id.JSON()}}

Choose value instead of variable .

I tried to see the output and it is working for me . Make sure we the variables are rightly called .
This is the email body , see how the get identities is referred :

The following is the output of it :

1 Like

Cheers! That explained why I couldn’t get the output to the email. Great, it seems to work fine with this minor change.

Much appreciated @sidharth_tarlapally

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.