I have a process model that cancel a task. I am getting an error email stating that the task to cancel does not exist. We should not experience this in our production environment since we check to see if a task has been completed. In our test environment we routinely clean up our task to prevent clutter. So, we have experienced this on occasion. UIs there a way to check to see if a task exists before trying to cancel it using the smart service? I was hoping there was a function or some query I could run.
Discussion posts and replies are publicly visible
I'd suggest creating a task report that you can query from that includes all tasks and a column for the task ID. You can add a filter to your query to only return a task with the given ID. Then, if no tasks are returned, then the task doesn't exist. Here's a sample query that you can run against your task report:
a!queryProcessAnalytics( report: cons!MY_TASK_REPORT, query: a!query( filter: a!queryFilter( field: <your ID column here>, operator: "=", value: ri!taskId ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 1 ) ) )
I'd also suggest reviewing the Task Report Tutorial
Thanks Peter. I will give it a try.
Peter, I was looking at the task report and I don't see that it contains the task id or process id. Is there another way to get that information?
I don't think task ID exists in the default "Tasks for User" report, but you can edit the report or create your own task report that includes the ID. Here's some more information about setting up the process report to include the task ID: https://docs.appian.com/suite/help/latest/Configuring_Process_Reports.html#adding-report-columns