Third-party plugin QlikSenseTask-3.x\QlikSenseTask.exe is always returning 0 as the task status result and an HTTP status code of 200 OK even though the task didn't start or started and failed.
Environment:
All versions of Qlik Sense
The executionresult endpoint will return a status of 200 OK with an empty array instead of a 403 Forbidden when incorrect permissions are used to call this endpoint, this was a decision by R&D, so it's not a bug. Unless the code changes, the issue is related to the logic in the method found here
https://github.com/eapowertools/QlikSenseTask/blob/36954f0fe185c5c4116070e282452d8d58e877b7/QlikSenseTaskSource-3.X/QlikSenseTask/QlikSenseJSONHelper.cs#L77 and as seen below:
public int GetTaskStatus(QlikSenseTaskExecutionGuid taskexecutionguid)
{
Dictionary<string, string> queries = new Dictionary<string, string>();
//queries.Add("filter", "name eq '" + taskname + "'");
//find the app
//string taskid = "";
string taskstring = qrsClient.Get("/qrs/executionresult/"+taskexecutionguid.value, queries);
List<QlikSenseTaskResult> tasks = (List<QlikSenseTaskResult>)JsonConvert.DeserializeObject<List<QlikSenseTaskResult>>(taskstring);
int retval = 0;
if (tasks.Count == 1)
{
retval = tasks[0].operational.lastExecutionResult.status;
}
return retval;
}Basically, the conditional expression,
if (tasks.Count == 1), is skipped because an empty array (0 elements) was returned from the API, so
retval returns as 0 to the user. With the correct permissions, the API would have returned a one element array containing task details, and
retval would have returned the real status from
tasks[0].operational.lastExecutionResult.status since
tasks.Count now equals 1.
Give user RootAdmin as the resource filters needed are not documented for a custom rule/role yet. Alternatively, a TaskAdmin rule/role can be created, which can call the needed endpoints without having RootAdmin access. See
Qlik Sense: Security rules needed to call task start and result endpoints for more information.