Is it possible to build in some kind of timer that starts when a transaction item is picked up and that acts when a certain amount of time has passed? Then timer then resets when the next item is picked up.
Thx for your insights.
Is it possible to build in some kind of timer that starts when a transaction item is picked up and that acts when a certain amount of time has passed? Then timer then resets when the next item is picked up.
Thx for your insights.
Yes.
You just need to have a timespan variable and a variable to store the current time to when you pick up the item. Then, you can basically do
(Now - startTime) >= timespan
as a condition, then perform your actions and reset startTime to Now before getting next item again.
timespan could be set to something like 00:05:00, for 5 minutes
startTime would be a DateTime type
I hope I have clear.
Thanks.
The idea would be to send an email to the developer when the time has exceeded, because these tasks are sequential would it the be possible to stop the email from being sent if the time hasnât exceeded its value?
Yeah, like I said you can use a condition like this:
if (Now - startTime) <= timespan
or
if (Now - startTime) <= 01:00:00
Send the email in the True side, and in the False side do something else.
Initialize startTime = Now as a dateTime variable type, and assign that right after you get each item to store the initial time.
Regards.
Hello,
Could I limit a workflow to be executed in a certain period of time (letâs say 1 minute), and if it is not executed in <=1minute, do a certain action?
I mean if it takes more than a minute to execute all the activities contained in a workflow, I want to do some actions such as sending an email.
Thanks a lot.
Regards
Hey, there are 2 ways to do this I think.
Orchestrator has a feature (if it is a scheduled job) where you can have it âStop or Kill Afterâ a certain amount of time. If you have it set to âStop Afterâ, it will trigger its âShould Stopâ. So when your workflow hits the âShouldStopâ activity, you can use that boolean in a decision and perform other actions - also if you Manually choose to âStopâ the process in Orchestrator. You might also be able to use this in a Parallel activity (to stop at anytime rather than inbetween items processed), though I would suggest having your shouldstop then in a separate workflow or library to invoke so it can continue to wait for ShouldStop in a loop, if you choose this approach.
The other way is to basically do the same thing in parallel, but instead of waiting for the ShouldStop to be True, you instead calculate the timespan and compare it in a decision to decide to perform those actions. - and like I said, you can do this inbetween items processed too instead of in parallel.
So maybe those are some ideas.
@ ClaytonM
Thank you very very much Clayton.
It would work if the whole process would take 1 minute to be executed. However, it takes 1 minute to process every operation of my process (my process consists of a huge amount of operations).
So what I would need is to establish a limit period of time so that each operation that lasts more than 1 minute, can be cancelled and then the following operation is executed.
Thanks.
I see, so you would probably prefer the approach of calculating the timespan in the code. Surround each iteration with a parrallel activity, and in parallel invoke a workflow that determines if the timespan has exceeded in a Do While loop, that also checks if the iteration is complete (maybe by some boolean variable) - so it can exit the Do While to go to the next iteration⌠if that makes sense. If the timespan is met, then you would Throw an exception so it can jump out of the iteration being processed so it can go to the next iteration.
âIf you give it a shot, let me know if you have other questions further on how to compose this logic. Regards.
Hi @pal1910
I felt like a sample might make you understand better, so I quickly put this together.
Main.xaml (14.5 KB)
So basically it loops through to process each iteration with a Parallel surrounding the process. After each activity, it will check the timespan and throw a businessruleexception if it is exceeded. Keep in mind, that this only works if an activity does not get stuck with no timeout.
I placed in a Delay to test this, so after the Delay ends, it throws the exception to move to next iteration.
Youâll need to make adjustments to meet your requirements.
I hope this helps better.
Regards.
Thanks a lot.
Thatâs a perfect solution for me!
Best regards
Hey Clayton, thanks for the solution, however, when I tried implementing the same, my process fails with a delay activity in the workflow!
Hi @ClaytonM, I appreciate your idea and found some interest issues as below.
Reference: Using the ParallelActivity Activity | Microsoft Learn
Refer to above reference, activities should be switched between SequenceActivities even faces DelayActivity. Any ideas? Thank you.
Iâm unsure how your code looks exactly. Keep in mind that [ Now-iterationStart
] in the right side of the parallel is based on total difference in time when you assigned âiterationStartâ, so ensure this is assigned in the correct place at the start of the iteration process.
It might help you to Log (Now-iterationStart).ToString
at some places, so you know when and where it is in the process and if it should hit the exception at that moment or not.
I might also suggest that the IF condition be changed to:
Not iterationComplete AndAlso Now - iterationStart >= maxIterationTime
so it doesnât accidentally throw exception at the end if the iteration was complete