14
Views
6
Comments
[BPT Activity Actions] Activity_SetNextRunDate doesn't work
bpt-activity-actions
Service icon
Forge asset by Stefan Weber
Application Type
Service
Service Studio Version
11.54.70 (Build 63475)
Platform Version
11.26.0 (Build 41987)

In this test case I created 2 Wait activities. Wait1 was with a set Timeout property of the activity and Wait 2 had Timeout property empty but I used Activity_SetNextRunDate function in Wait2/OnReady. After process launch Wait1 was showing 'Next Run' and closed correctly but Wait 2 doesn't show 'Next Run' which should be set by the function and therefore it doesn't close.

2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi, to be honest I never used the low level method in the OnReady. I doubt that this is intended to work at all because, when the Wait activity starts (OnReady) it already evaluated its input parameters. That said to have a wait you have to initially set a timeout value and setting it in the OnReady is just to late for the activity to recognize a waiting state.

But as said. I never used it that way, so its just a good guess.

I get the initial timeout value in an automatic activity and set the initial timeout via the output parameter. The low level function is more suitable - at least in my cases - in the OnClose to prevent closing the activity and reset the timeout value to a new value.

Attached is a very simple example (OML) of such a flow. I hope that helps.

Stefan

WaitSample.oml
UserImage.jpg
Radosław Grabowski

Hello, thanks for quick response. 

I tested such action flow in OnClose - it executes 30 seconds after creation (AddSeconds(CurrDateTime(),30) in Wait activity Timeout property). 

In OnClose action flow in Activity_SetNextRunDate I set AddSeconds(CurrDateTime(),30) (but the value doesn't really matter) and explicitly raise exception.

The result is that the commit in Activity_SetNextRunDate somehow causes to ignore the exception, because the activity closes without errors on that first try and the output parameters (OriginalTimeout, UpdatedTimeout) are filled when they should not be. When I remove Activity_SetNextRunDate from the action flow the exception functions correctly and rollbacks the transaction and activity doesn't close.

So the only use of this function would be outside of process flow when there is need to trigger the change of Timeout/NextRun value (and this is exactly what I need), but I'm not sure (haven't tested yet) if this also works in the flawed way like in the case mentioned above (ignored exception) so for obvious reasons (security, data consistency) I couldn't afford that solution.

Regarding your answer about OnReady - isn't it that it is too early (activity not yet initialized so it doesn't have any property that could be updated) and not too late? I don't get your logic, because if it would be too late then in the OnClose it should've been definitely too late :)

2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi, What I meant with too late is, that if you havent set any parameter for the timeout then the initialization of the wait activity takes place without respecting a timeout value and in the OnReady it would be just to late.

Have you checked the sample I attached? This one is an extraction of a running project.

Stefan



UserImage.jpg
Radosław Grabowski

What I set in action flow on attached picture is analogical to the sample, I have just adjusted the logic in my test case to explicitly test behaviour of changing the next run date. The core algorithm for that is the same: Wait activity initialized with Timeout value filled and then in OnClose I invoke Activity_SetNextRunDate and then raise the exception. It doesn't work.

2021-10-09 07-57-44
Stefan Weber
 
MVP

Would you be able to share your OML? Maybe it is just something small you missed. The extension just wraps the OutSystems Low-Level API for SetNextRunDate of an Activity, so nothing special here.

Iam currently on vacation, so it will take a while for me to take a look at it.

UserImage.jpg
Radosław Grabowski

I've just tested Activity_SetNextRunDate outside of the process flow (triggered by the button) and it also doesn't work.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.