Stopping a Scheduled Process at a Certain Time

I am working on a process model and it needs to stop at a certain time (For example 2PM CST)

However, I don't see any option to do it. I've tried working on the advance options but it seems like that doesn't satisfy it as well.

This was the condition that I put in Advance Options

now() < local(fn!todate(today()), timezoneid()) + 30/24

Any suggestion is welcome.

  Discussion posts and replies are publicly visible

  • I don't think the advanced options are going to help you in this case. For context, the expression in that condition gets evaluated once: it doesn't keep evaluating until the current date and time is greater than what you provided.

    Instead, I'd suggest just putting that condition into the scheduled delay section:

    Also keep in mind that there isn't really a "stop" option in a process, so you would likely create a parallel flow that goes to this timer. Then, when the timer is triggered, it should go straight to a terminate end node to stop the process.

  • Hello Lgotx,
    based on the description provided i would suggest that you create an exception, inside your exception you will need to set it up as "Skip this node at the date and time specified by this expression:" then you give it the time

  • 0
    Certified Lead Developer

    It seems like a terrible idea to stop a process before it's complete.  However, if that's what you intend to do, you could set up a second start node to activate a set amount of time after the first start node is scheduled to go off.  For instance, start 1 scheduled to go off at 1 PM, start 2 scheduled to go off at 2 PM.  Then you can have the secondary process flow go through whatever tasks you want before winding up on a Terminate End node.  That will kill the process in the middle of whatever it was doing.

    You could also start the process normally then first node it hits is an AND gateway.  Have the secondary flow from that AND gateway stop at a Timer event.  You can set the Timer event to run for an Hour, exactly 55 minutes, whatever you want, then send that end of the flow to a Terminate.  It will kill whatever was going on with the other thread.

    Again, highly recommended that is NOT how you do this, but if you really want to know that's how I would do it.

  • Additional ideas here would depend on your use case, if you could elaborate a little there - how/when is this process started, what is it doing when you want it to stop, does it need to continue later or end completely, etc?

    Another general option is to have a rule determine if the process should be online or not based on the current time.  The process can run through XOR gates between each step, checking this rule to determine if it should be online or not - then continue or end.  But I wouldn't know if that could apply cleanly here without additional use case details. 

  • I disagree that it's a bad idea to stop a process - it's actually a good practice to set up your processes so that they end if there is no activity in the process for a while. For example, suppose that you create a process that allows you to submit a case that uses a User Input Task as the first form for submitting the case. If the user starts the form but abandons it, it's a good idea to have a parallel path like you mentioned that would close out the form. Of course this is often set up at the form level as an exception, but there may be similar cases where you'd like to have the entire process time out regardless of which step you're currently working on.

  • Here is the use case:

    • Process runs on interval every 30 minutes daily.
    • Process stops running after 2PM CST.

    And thats it.

  • Thanks, to confirm further, I'm not clear which one of these is the goal:

    1) Block a process from starting after 2 PM, or

    2) Attempting to pause or end a process that had already started prior to 2 PM?

  • 0
    Certified Lead Developer
    in reply to Peter Lewis

    Oh, you're absolutely right, in that case, it is a very good idea to have things time out after periods of inactivity. One of the programs that we're going through now is attempting to make all processes close eventually.  You're right, that is very important, but only when you do it very intentionally, in places where the process HAS to be stuck and not actively processing data when you cancel it.

    What sounds bad to me is stopping a headless process after exactly an hour.  Who knows if you're on loop 888 of 900 of a forEach and will absolutely destroy the data.

    I think it should be much smarter than simply, "you've got one hour." That is, of course, unless it's a headless process that should take 5 minutes.  A better solution, in that case though, would be to NOT cancel the process, so you can see why it took more than 55 minutes longer than it should.  Cancelling it just allows it to archive so you never find the problem.

  • Run the process every 30 minutes and then block the process from running after 2PM

  • 0
    Certified Lead Developer
    in reply to legotx

    Oh!  When do processes start?  You could literally just create a list of times that the process would start including every half hour interval in which you would like the process to start.

    Or you could do if (now() < 2 PM, if now() minutes = 30, run, don't run, don't run)