What's the best practice to cancel an specific process instance?

whenever, we need to cancel a process instance based on a decision made in some other process. I see we have some options like Send/Receive message, Cancel Process, Set external P Vs Activity but not sure which is the best practice to use?. Can you please suggest on which option too choose and if there's any differences.

Thanks in advance.

  Discussion posts and replies are publicly visible

  • Certified Senior Developer
    Create a process instance report where they could see the running instances,They could then click on the record and drill down to a dashboard that would have a quick task that would allow them to cancel the process instance by flowing to a terminate node.
  • Certified Senior Developer

    In all of the cases you would need instance Id of the process you want to terminate. Here is the pros and cons of each approach:

    1. Cancel Process: The decision logic to cancel a process instance lies within the parent process. Child process status is changed to Cancel.

    PROS:

    • Requires less configuration. Bcoz one node is enough to do the job
    • Sail component is available, so you can call it from an interface and cancel a process instance

    CONS:

    • User requires admin access of child process to cancel it
    • Parent process might not have all decision parameters
    • Does not show dependent/Precedent relationship

     

    2. Send/Receive Message: The decision logic can be distributed between parent and child process instances. Process status is changed to completed

    PROS:

    • Decision to terminate lies with child process. So doesn't require additional permission
    • Child process will have better exposure to processes current state. Hence best candidate to take termination decision. Ex. There is some change in business logic of child process. It is easy to notice termination logic, rather then it residing in parent.

    CONS:

    • Receiver is always in active state, always waiting to listen from Sender, until terminated. Consumes more resources
    • Configuration needs to be made in both processes, Sender in parent and Receiver in child
    • Cannot be called directly from Interface. However you can place this Send message node in a process and trigger PM from interface.

     

    Hope this helps to decide which approach you want to take as per requirement.

  • thanks for the suggestion prakash, but I wanted something which will be automatic without manual intervention. Like once a process is cancelled the other process shold also be cancelled.
  • A Score Level 1
    in reply to Deepa_M
    Thanks deepad13 for the detailed differences, will try both options. Might go with Send/Recieve message option.
  • A Score Level 2
    in reply to sindhum950
    Hi Sindhu, Please try to go with Cancel Process option. Please go through the cons mentioned above for receive message event.
  • Hello Sindhu

    This is such a good question, I liked it a lot. Definitely I agree with Deepa D those are the ways to cancel the processes. personally I prefer the send message option.

    I just wanted to ask you little more about your use case. why you have to kill instances? is that happening a lot?

    One scenario I can imagine is that you have a process and you need to cancel it because the record was cancelled or expired? or maybe you have one task which doesn't apply any more to the process because something else happened?

    Now let me tell you the reason I liked your question, I started thinking if you had the option not to create a process which will be killed, what if you can handle it DB oriented with some status?

    Jose