Identify the Process instance ID of a cancelled process for re-triggering the instance

Hello !

I have a requirement to re-trigger a specific process model instance, that is cancelled automatically as part of a existing process. The specifics in this is that I would need to achieve this via a process model automatically. I can use the Resume or Start Process smart service for achieving this but the smart service expects the process ID.

I have the process name, process model ID, process model UUID and the employee ID that is used as part of the process as a process variable. Using these, is there a way to identify the process instance ID?

Thanks !

  Discussion posts and replies are publicly visible

  • Assuming the canceled process instance hasn't already been archived, I think what you could do is create a report where your process model is the context that would contains all the necessary fields (in your case, at least pp!id) and add a filter that matches based on Employee ID.

    Once you have the above set up, you can use the smart service called "Execute Task Report" (where the report I mentioned above you would have to create is the context) before "Start Process" smart service in a newly created process model to start that canceled process instance.

    Note: If filtering on employee ID returns multiple instances, then you'll need an additional filter like something below:

    1. not(isnull(process_completion_time()))
    2. num_cancelled_tasks() <--- this is a process metrics function (will probably need more to do than just the function itself)
  • We have found it handy to retain the process id (pp!id) for some process models that are likely to run for a while in the database. When the process is created and we store the key data fields for the process/application in a CDT/database table we add a processid column to the CDT. By storing it in the database we can access it when needed for debugging or possibly sending messages to the process.

    A few thoughts:
    1) pp!id values can be reused sometimes, so you may want to consider setting the value to null in your cdt/database when you complete the process model and don't anticipate needing it anymore (so you don't retain legacy ids that may cause duplicates in the future)
    2) the pp!id I believe is stored as an integer but sometimes needs to be stored as a text field I think, or maybe it is the other way around. just be aware of the data type that Appian sees it as in the reports, etc. You don't want leading 0's to be lost, etc.
    3) we haven't restarted processes using this method I don't believe, but you probably would want to verify the process exists before calling the restart node smartservice, etc. I've found that some Appian functions are a bit finicky with null values and invalid values (for instance, if you have a user with a supervisor and the supervisor's account is disabled, the update user profile smartservice hiccups because of the essentially invalid supervisor.
  • The process report doesn't depicts all the active instances rather depicts only one instance. The filter and criteria are correct but I thought it depicts all the instances of that process but doesn't seems to the case. Any thoughts on this?
  • 0
    Certified Lead Developer
    in reply to Bala
    You most likely have a configuration issue with your process report, then. If you'd be able to post screenshots of your configuration details (report context, filtering, etc), we can probably help figure it out.
  • 0
    Certified Lead Developer
    in reply to Bala
    Your bottom screenshot does seem to show multiple instances including a cancelled one - is that not what you're seeing in your report? You also didn't show the first configuration tab showing the report context / etc.
  • Fortunately we have this process id stored in the database thereby it made my task easier in a way to achieve the solution. Here is what I did - I relayed on the process id that was extracted using a query on db to the 'Start All Nodes' smart service. This smart service accepts the UUID of a specific node along with the process id. Since the UUID (of the start event for the process that needs to be restarted automatically) is constant in this scenario, thereby relaying on the process id as the other parameter, I was able to programmatically trigger the process.

    Thank you all for chiming in on this !