I have a workflow where I am unable to reference the loop input or loop context and I am not sure why.
In the Loop Input I am passing an http request’s response body ($.hTTPRequest.body) and in the Loop Context I am passing an earlier get Identity call ($.getIdentity).
I expect to be able to reference anything from the HTTP Request response body and anything from the get identity call within actions taken inside my loop.
What I am experiencing is the variable values appear as empty. For instance, one of the steps inside my loop is an HTTP operation to patch the sources we are iterating over. I am sending the following body:
[
{
"op": "replace",
"path": "/owner",
"value": {
"id": "{{$.loop.context.id}}",
"type": "IDENTITY"
}
}
]
For this, the json during execution appears as:
"jsonPatchRequestBody": [
{
"op": "replace",
"path": "/owner",
"value": {
"id": "",
"type": "IDENTITY"
}
}
]
I know the context is getting loaded correctly because in the workflow execution I see the context appear as expected:
"attributes": {
"displayName": "Loop",
"input": {
"context": {
"id": "123456",
.
.
.
}
}
Is there anything I am missing? I previously had this working and am wondering if a recent patch caused this workflow bug.
Note: it should be noted that in addition to the variables resolving as empty, I also receive the following error msg:
"attributes": {
"displayName": "Loop",
"result": {
"loopOutput": {
"failureItems": [
{
"errorMessage": "unexpected end of JSON input",
"payload": null
}
],
"successfulItems": null
}
},
"stepName": "loop",
"task": "sp:loop:iterator"
}