How to use array element from HTTP response in inline variable inside a loop?
I’m building a workflow that loops over devices from Microsoft Intune, searches an external API for each device, then makes a PUT call using a value from the search response. The search response returns an array, and I need to use a field from the first element in the PUT URL.
The problem: I cannot get the originId (an integer) from the search response array into the PUT URL using inline {{ }} variables. I’ve tried every approach I can think of over many hours and none work.
Workflow Structure (simplified)
Get Identity → Get User Devices (Intune) → Loop Over Devices
└── inside loop:
Compare Strings (skip specificString)
→ HTTP Request 1 (Search external API)
→ HTTP Request 2 (PUT to external API)
HTTP Request 1 (Search) Response
Returns an array in the body:
{
"body": [
{
"originId": 879845865,
"name": "DEVICE-NAME"
}
],
"statusCode": 200
}
HTTP Request 2 (PUT) Needs This URL
https://api.example.com/policies/12345/identities/879845865
The 879845865 must come dynamically from the search response above.
What I’ve Tried
1. Bracket notation in {{ }}
{{ $.hTTPRequest1.body[0].originId }}
Result: Resolves to empty string. API returns "identityId must be a number".
2. Dot notation in {{ }}
{{ $.hTTPRequest1.body.0.originId }}
Result: Same — resolves to empty string.
3. Define Variable operator to extract the value
Configured Define Variable with:
variableA.$=$.hTTPRequest1.body[0].originId- No transforms
The .$ extraction works perfectly. Execution history shows:
"defineVariable": {
"deviceOriginId": 879845865
}
But using it in the PUT URL:
{{ $.defineVariable.deviceOriginId }}
Result: Still resolves to empty string.
4. Define Variable + .JSON() function
{{ $.defineVariable.deviceOriginId.JSON() }}
Result: Same empty string result.
5. Define Variable + Substring transform (force string conversion)
Added a Substring transform (start: 0, length: 20) to the Define Variable to coerce the integer to a string.
Result: IndexOutOfBoundsErr: length: 0 — the Substring transform cannot operate on the integer value.
6. Define Variable + Concatenate transform (build full URL)
Set Variable A to the static URL prefix and tried to Concatenate the dynamic originId.
Result: Concatenate’s Variable B only accepts static values, not dynamic .$ references. Using .$ in the Advanced editor returns "error parsing input".
7. Nested loop over search results
Attempted to add a sp:loop:iterator inside the existing loop to iterate over $.hTTPRequest1.body, which would make $.loop.loopInput.originId available without array indexing.
Result: SailPoint does not support nested loops.
What I’ve Confirmed
- The
.$suffix correctly resolves$.hTTPRequest1.body[0].originIdto879845865(visible in execution history under the Define Variable output) - All working
{{ }}expressions in my workflow reference string values from action-type steps:{{ $.getIdentity.attributes.email }}— works{{ $.loop.loopInput.deviceName }}— works
- The
{{ }}interpolation appears unable to reference Define Variable (Mutation-type) step outputs - Both
sp:httpsteps use version 3 with built-in OAuth
My Questions
- Is there a supported way to access an array element inside
{{ }}inline variables? - Can
{{ }}reference Define Variable (Mutation-type) step outputs? If so, what is the correct syntax? - Is there another approach entirely for getting a value from an HTTP response array into a subsequent HTTP request URL?
Using ISC (SaaS), workflow builder. Any help is greatly appreciated! I’ve been stuck on this one issue and the rest of the workflow runs end-to-end perfectly.