I am trying to create a workflow where if an access profile is approved, the workflow triggers and checks the request decision. The workflow then checks if the access profile contains the entitlements from a specific OU, while doing this i also pull the list of entitlements in that Access profile with HTTP action(by calling search api).
I am trying to run a loop over each entitlement and do an API call using HTTP action with the value of entitlement in its body.
While trying to do this, I am getting errorMessage : “unexpected end of JSON input”,
Could you please share what I may be doing wrong here?
I changed the configuration a little and I am not getting any error while doing the http request but the reference variables used in the HTTP action are not able to pull any value. Below is the body of HTTP action
</>
{
“sysparm_id”: " ****************** “,
“sysparm_quantity”: “1”,
“variables”: {
“affected_ci”: “IdentityNow”,
“approval”: “requested”,
“category”: “**************”,
“description”: " \r\n
- User Name: {{$.trigger.requestedFor.name}}
- Date Executed: {{$.defineVariable.time}}
- Object:{{$.loop.loopInput.value}}
- Action taken by: identity now
”,
“req_description”: " \r\n
- User Name: {{$.trigger.requestedFor.name}}
- Date Executed: {{$.defineVariable.time}}
- Object: {{$.loop.loopInput.value}}
- Action taken by: identity now
",
“req_short_description”: “User {{$.trigger.requestedFor.name}} Removed to {{$.loop.loopInput.value}}”,
“request_state”: “requested”,
“short_description”: “User {{$.trigger.requestedFor.name}} Removed to {{$.loop.loopInput.value}}”,
“state”: “New”,
“sub_category”: “IdentityNow Service Request”
}
}
</>
Variables defined outside of a loop cannot be called inside the loop. You will need to define the loopinput and loop context to be called inside the loop.
Try defining a Get Identity Action before your loop and then make it as the loop context, that way you can call the Identity attributes inside the loop like $.loop.context.name
Also, you may want to change the object as Object: {{$.loop.loopInput}} as your loop input is already the entitlement value.
Take a look at the loop operator documentation for detailed info.
And the define variable to get the time stamp can also be called inside the loop instead of outside of it.