Process Instance errors

Certified Senior Developer

Hello everyone,

I am building an Appian process that needs to have only one instance running at a time, since every instance would be inserting to/ truncating the same database table. In order to achieve this, at the beginning of the process I check if the current instance is the oldest among the active instances of the process, through a query to a process report. 

This works just fine, the problem is that I want to also check if the oldest instance has, for whatever reason, a node with error and therefore it's flow has been blocked. This way I could kill that instance or skip it in order not to block the other instances in the queue. What I noticed is that even though a process may have a node with errors, the status in the process report remains "Active", so I couldn't find a way to verify through the Report. Even the functions num_problem_tasks() and num_active_tasks() are not helping. 

Do you guys know of any efficient way to make this control happen?

Thanks in advance 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Hi Laert,

    Regarding the ability to identify errored process models - there is a plug in available in the App Market here which provides the ability to query active process model instances and identify any with nodes that are 'Paused By Exception'.

    Admittedly, this plug-in is a bit 'rough round the edges' with some strange syntax but the included smart services will definitely allow you to check if the process instance has a node error and retry/skip when required.

    We had a similar use case in our application: some of our 'Write to data store entity' nodes would fail if the JDBC connection dropped, and the process instance would remain active until a developer manually retried the node. We used the plug-in to automatically retry these nodes and also produce a report for process models that have attempted to be retried 5 times.

    The plug-in documentation should provide all the information you need to get your desired functionality, but feel free to reach out if you face any troubles.

  • 0
    Certified Lead Developer

    As a side note, I'd advise a bit of caution when using a process report to manage the number of instances running for a given process model. Process reports can be slow depending on application performance and it is not immune from 'race condition'.

    I would advise using a 'pessimistic locking' strategy to ensure only one process instance if race condition is likely. You can use the Appian objects provided in this app solution here: https://community.appian.com/b/appmarket/posts/pessimistic-locking to achieve this.

    We had a similar use case as you in our application and implemented pessimistic locking as the process reports weren't reliable/quick enough for us.