For sure. The Do Until step I am using should work with this Esri Action, based on what I am seeing in the JSON output. But there are things I do before this to set it up, so there will need to be tweaking one way or another to get this to work in your set-up.
For context, I believe the Esri Create Report Action would be the equivalent of my "HTTP - Create Report" step:
Here are the components (starting at the first Parse JSON):
1. Parse JSON - Job ID + Job Status
Body = The previous "HTTP - Create Report" in my first screen cap (so, probably your Esri Create Report Action?)
Schema =
{
"type": "object",
"properties": {
"jobId": {
"type": "string"
},
"jobStatus": {
"type": "string"
},
"submitted": {
"type": "integer"
},
"resultInfo": {
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
},
"inputInfo": {
"type": "object",
"properties": {
"jobType": {
"type": "string"
},
"parameters": {
"type": "object",
"properties": {
"featureLayerUrl": {
"type": "string"
},
"queryParameters": {
"type": "object",
"properties": {
"objectIds": {
"type": "string"
}
}
},
"templateItemId": {
"type": "string"
},
"portalUrl": {
"type": "string"
}
}
}
}
},
"success": {
"type": "boolean"
}
}
}
2. Set variable - jobId
Value = jobId from the previous Parse JSON
3. Do Until - Create Report Job Finished
3a. Do Until's Logic. Must be entered in Advanced mode.
@or(equals(variables('jobStatus'), 'esriJobSucceeded'), equals(variables('jobStatus'), 'esriJobPartialSucceeded'), equals(variables('jobStatus'), 'esriJobFailed'))
3b. Delay - 5 seconds (Get jobStatus)
Simply a 5 second delay. This helps the Loop run smoothly.
3c. HTTP - Get jobStatus
This one will be interesting... JobId you already have from above. But Token I set previously. Not sure how to best accommodate that.
3d. Parse JSON - Result Info
Body = Previous HTTP step
Schema =
{
"type": "object",
"properties": {
"jobId": {
"type": "string"
},
"jobStatus": {
"type": "string"
},
"submitted": {
"type": "integer"
},
"completed": {
"type": "integer"
},
"resultInfo": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"totalCount": {
"type": "integer"
},
"resultFiles": {
"type": "array",
"items": {
"type": "object",
"properties": {
"objectIds": {
"type": "array",
"items": {
"type": [
"integer",
"string",
"number"
]
}
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"url": {
"type": "string"
}
},
"required": [
"objectIds",
"name",
"size",
"url"
]
}
},
"succeededObjectIds": {
"type": "array",
"items": {
"type": "integer"
}
},
"failedObjectIds": {
"type": "array"
},
"details": {
"type": "array"
}
}
},
"inputInfo": {
"type": "object",
"properties": {
"jobType": {
"type": "string"
},
"parameters": {
"type": "object",
"properties": {
"featureLayerUrl": {
"type": "string"
},
"queryParameters": {
"type": "object",
"properties": {
"objectIds": {
"type": "string"
}
}
},
"templateItemId": {
"type": "string"
}
}
}
}
}
}
}
3e. Set variable - jobStatus
Value = jobStatus from previous Parse JSON step.
4. Condition - Job Succeeded or Failed
This Condition is probably the most important part. If the report doesn't print, it goes to the If no branch, which resets the flow. If the report does print, it hits the If yes branch, and does whatever the next steps are.