# Workflow - Define Variable - Input string has a list

**URL:** <https://developer.sailpoint.com/discuss/t/workflow-define-variable-input-string-has-a-list/54218>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [April 25, 2024, 8:33pm UTC](https://developer.sailpoint.com/discuss/t/workflow-define-variable-input-string-has-a-list/54218 "2024-04-25T20:33:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpotti](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mpotti/32/2916_2.png) [@mpotti](https://developer.sailpoint.com/discuss/u/mpotti)\
**Post date:** [April 25, 2024, 8:33pm UTC](https://developer.sailpoint.com/discuss/t/workflow-define-variable-input-string-has-a-list/54218/1 "2024-04-25T20:33:31Z")

</div>

I am working on a workflow that will compare the USER ID that we get from WD and compare it with the other connected sources. I am using the define variable action in order to just extract the USER ID’s for each of the sources.

Connected Sources:  
ServiceNow - Test  
ServiceNow - Training  
Workday - Sandbox  
Active Directory - Lab

I am able to successfully define AD and WD USER ID’s using the Json Path. When I get to Service now it has an input list object so the variable never sets the value from the list. I have tried a number of thing to dig into the list and have come up with the same results or no results at all. Anyone have any ideas how I can extract the first value in the list?

Input Object:

```auto
{
  "id": "sp:define-variable",
  "variables": [
    {
      "description": "",
      "name": "Workday SamAccountName",
      "transforms": [],
      "variableA": "dmcmil0"
    },
    {
      "description": "",
      "name": "AD SamAccountName",
      "transforms": [],
      "variableA": "dmcmil02"
    },
    {
      "description": "",
      "name": "ServiceNow SamAccountName",
      "transforms": [],
      "variableA": [
        "dmcmil02",
        "dmcmil02"
      ]
    }
  ]
}

```

Step Output:

```auto
{
  "aDSamAccountName": "dmcmil02",
  "serviceNowSamAccountName": "",
  "workdaySamAccountName": "dmcmil0"
}

```

Full Workflow Json Config:

```auto
{
    "id": "0682e84d-36d3-4d00-83ae-142aa55f66da",
    "name": "POC - User with multiple UserIDs",
    "description": "",
    "created": "2024-04-25T18:48:37.539346923Z",
    "modified": "2024-04-25T20:22:39.341495611Z",
    "modifiedBy": {
        "type": "IDENTITY",
        "id": "REMOVED",
        "name": "REMOVED"
    },
    "definition": {
        "start": "Get Identity",
        "steps": {
            "Compare Strings": {
                "choiceList": [
                    {
                        "comparator": "StringEquals",
                        "nextStep": "Compare Strings 2",
                        "variableA.$": "$.defineVariable.workdaySamAccountName",
                        "variableB.$": "$.defineVariable.aDSamAccountName"
                    }
                ],
                "defaultStep": "Compare Strings 1",
                "displayName": "Compare Strings WD to AD",
                "type": "choice"
            },
            "Compare Strings 1": {
                "choiceList": [
                    {
                        "comparator": "StringEquals",
                        "nextStep": "Send Email",
                        "variableA.$": "$.defineVariable.workdaySamAccountName",
                        "variableB.$": "$.defineVariable.serviceNowSamAccountName"
                    }
                ],
                "defaultStep": "Send Email",
                "displayName": "Compare Strings WD to SNow",
                "type": "choice"
            },
            "Compare Strings 2": {
                "choiceList": [
                    {
                        "comparator": "StringEquals",
                        "nextStep": "End Step - Success",
                        "variableA.$": "$.defineVariable.workdaySamAccountName",
                        "variableB.$": "$.defineVariable.serviceNowSamAccountName"
                    }
                ],
                "defaultStep": "Send Email",
                "displayName": "Compare Strings WD to SNow",
                "type": "choice"
            },
            "Define Variable": {
                "attributes": {
                    "id": "sp:define-variable",
                    "variables": [
                        {
                            "description": "",
                            "name": "Workday SamAccountName",
                            "transforms": [],
                            "variableA.$": "$.hTTPRequest.body[*].attributes.USERID"
                        },
                        {
                            "description": "",
                            "name": "AD SamAccountName",
                            "transforms": [],
                            "variableA.$": "$.hTTPRequest.body[*].attributes.sAMAccountName"
                        },
                        {
                            "description": "",
                            "name": "ServiceNow SamAccountName",
                            "transforms": [],
                            "variableA.$": "$.hTTPRequest.body[*].attributes.user_name"
                        }
                    ]
                },
                "displayName": "",
                "nextStep": "Compare Strings",
                "type": "Mutation"
            },
            "End Step - Success": {
                "displayName": "",
                "type": "success"
            },
            "Get Identity": {
                "actionId": "sp:get-identity",
                "attributes": {
                    "id.$": "$.trigger.recipient.id"
                },
                "displayName": "",
                "nextStep": "HTTP Request",
                "type": "action",
                "versionNumber": 2
            },
            "HTTP Request": {
                "actionId": "sp:http",
                "attributes": {
                    "authenticationType": "OAuth",
                    "jsonRequestBody.$": "",
                    "method": "get",
                    "oAuthClientId": "REMOVED",
                    "oAuthClientSecret": "REMOVED",
                    "oAuthCredentialLocation": "oAuthInHeader",
                    "oAuthTokenUrl": "REMOVED",
                    "requestContentType": "json",
                    "url": "REMOVED",
                    "urlParams": {
                        "filters": "identityId eq \"{{$.getIdentity.id}}\""
                    }
                },
                "displayName": "",
                "nextStep": "Define Variable",
                "type": "action",
                "versionNumber": 2
            },
            "Send Email": {
                "actionId": "sp:send-email",
                "attributes": {
                    "body": "<p>Workday ID: ${WorkdayID}</p>\n<p>AD ID: ${ADID}</p>\n<p>ServiceNow ID: ${ServiceNowID}</p>",
                    "context": {
                        "ADID.$": "$.defineVariable.aDSamAccountName",
                        "ServiceNowID.$": "$.defineVariable.serviceNowSamAccountName",
                        "WorkdayID.$": "$.defineVariable.workdaySamAccountName"
                    },
                    "from": "noreply@sailpoint.com",
                    "recipientEmailList": [
                        "REMOVED",
                        "REMOVED"
                    ],
                    "subject": "User has missed matched account ids"
                },
                "displayName": "",
                "nextStep": "End Step - Success",
                "type": "action",
                "versionNumber": 2
            }
        }
    },
    "enabled": false,
    "executionCount": 0,
    "failureCount": 0,
    "creator": {
        "type": "IDENTITY",
        "id": "REMOVED",
        "name": "REMOVED"
    },
    "owner": {
        "type": "IDENTITY",
        "id": "REMOVED",
        "name": "REMOVED"
    },
    "trigger": {
        "type": "EVENT",
        "attributes": {
            "id": "idn:post-provisioning"
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![vkashat](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vkashat/32/9721_2.png) [@vkashat](https://developer.sailpoint.com/discuss/u/vkashat)\
**Post date:** [April 25, 2024, 11:13pm UTC](https://developer.sailpoint.com/discuss/t/workflow-define-variable-input-string-has-a-list/54218/2 "2024-04-25T23:13:17Z")

</div>

Hmm, I don’t think the define variable operation supports lists, you may have to use a loop and iterate over the ServiceNow usernames and create a separate variable for each one.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [June 24, 2024, 11:13pm UTC](https://developer.sailpoint.com/discuss/t/workflow-define-variable-input-string-has-a-list/54218/3 "2024-06-24T23:13:50Z")

</div>

Closed on June 24, 2024, 11:13pm UTC

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