How to take action or trigger a process based on Task state change

We are attempting to write task information to the database based on the changing state of a task: Opened, Assigned, Accepted, Completed. Is there a way to accomplish this?

OriginalPostID-237255

  Discussion posts and replies are publicly visible

  • Tobi, can you be more specific as to what 'task information' you are looking to write? For statuses like "Completed" or "Assigned", you can add a Write to Data Store node to your process model before/after the task, and for statuses like "Opened" or "Accepted", you could use the a!writeToDataStoreEntity() function within interface SAIL code to write information to the database
  • @tobil To the best of my knowledge, there isn't a clear solution for this. It might be relatively easier to write assigned status(trigger a sub-process as soon as the user input task is hit) and completed status(post completion of the task).

    But the statuses such as Reassign, Accept, Reject, Return Task to actual assignees etc are hard to capture until you depend on a process that makes use of a timer to query the task status frequently and I believe this kind of mechanism is really expensive. The problem here is, Appian hasn't yet provided the capability to capture the Reassign, Accept, Reject, Return events that we perform on a Task.

    One option you might think of is, having all the functionalities such as Reassign, Accept etc on the form but it may not be a great idea to override or ignore the OOTB functionalities extend this kind of functionalities to each and every task. Have you had a look at 'Task Metric Utilities' plugin at http://bit.ly/2cY6mgB? If not, try to do so. It doesn't fit your requirement for sure but might give you a kick start in case if you think of a batch process. (Difference is that the plugin is designed to run on nightly basis afaik whereas the one which you want should actually run a process which will constantly monitor the status of Task)

    The other option you might need to think of is to visit the API and see what it offers to you in order to retrieve the desired information.

    Finally, I would also suggest giving thoughts over the value addition to Business in doing so. Maybe if you can elaborate the business use case, the practitioners here might come up with some alternate solutions.
  • In order to use the a!writeToDataStoreEntity(), the user would have to interact with any of the components(that has 'saveInto' attribute) on the interface. So the status won't be known really unless the user starts working on the form post accepting the Task. Also, we might not be able to track the events such as Reject, Return, Reassign etc with this approach. Next to it, we need to think about the component under which we want to use the a!writeToDataStoreEntity(). If we are creating a field for interaction especially intended for this functionality, that should be fine. Else we should place either under all the components in the form or under the saveInto of Submit button, and obviously, the earlier one may not be great. Also, there is a restriction that we can use only one smart service function inside a 'saveInto'.
  • Thank you for your input, I will take your suggestions back to my team and see what we can use!
  • You will need to use an asynchronous flow in your process (or another process that is always on and looking for the active processes) and use a shared component such as Task Functions to check the status of the task and update the DB. Please not this is solution will not be accurate within milliseconds, but could probably be accurate within a few seconds.