1428
Views
13
Comments
Solved
Add a wait action to server action
Question
Application Type
Reactive

Hi All,

I am trying to add some kind of wait or delay to a server action. I actually want this to be a seperate process since it should not involve my regular application flow. 

What I am trying to accomplish is that after a user completes an action, an email is send out with a delay of 15 minutes. I want this delay since it can occur that a user makes changes and the email could go out to the wrong person. I am pretty sure that with the 15 min delay this should be solved. 

I thought about using an entity that stores the data entered by the user with the mail recipient included and run a timer every 15 minutes to see if the created/updated date is at least 15 min in the past. This will probably solve it but I think that should be a more professional solution using the process activities or something. 


Anyone who can help?

Max

2021-11-24 11-38-48
Luís Cruz
Solution

@Max de Groot read also about BPT and Light BPT.

With something like this you can get what you want.




2023-08-24 15-18-41
ANDRES MAYR

i am not in need is Max, please check this mate. 

2021-11-24 11-38-48
Luís Cruz

I misunderstood, I thought the question"did you set up how to send emails from reactive ? " was a doubt of yours, sorry mate my fault :)

2020-07-02 13-32-59
Max de Groot

Hi Luis,

I already though about this and your solution looks very promising. The problem is that I am using a Service Module as core module where the action of creating or updating the record takes place. This means that this is not available in the client side where my email logic is situated. So it seems I am unable to trigger the automatic process. 

Do you have any idea if exposing the CreateUpdate action from the core will be 'visible' enough for the client side to trigger the automatic process? I can try this tomorrow but maybe you know the answer or another solution to this problem. 

Thanks! 


Max

2020-11-13 07-48-15
Khuong Truong

Hi Max,

You can write a public Save server action in your core module. Inside your Save action you can call the built-in Create<Entity> or CreateOrUpdate<Entity> or Update<Entity>. This way can trigger automatic process.

Regards,

Khuong

2021-11-24 11-38-48
Luís Cruz

Hey,

Like Khuong said.

Another way is to have a Entity on the core that you add a record to send email, with a CreatedOnDateTime attribute (and others that you know better).

On the email module, a Timer checking every minute if there are new records on the table to send emails after 15 minutes of the CreatedOn.


But still, not the best aproach imo...

2023-08-24 15-18-41
ANDRES MAYR

This may help you : 

Please check the app. 

overall you need to : 

1 . on the core layer  : set the automatic process with : addminutes(currdatetime(),15) parameter and any detail. set as INPUTS the parameter that the Email is going to receive from the cliente. in the attached, i just set 2 parameters.  REMEMBER THAT EMAIL MUST BE SET IN TRADITIONAL WEB , REACTIVE DOESNT SEND EMAILS. 

2. expose process as public same for the email. 

3. in the end user layer : crear the inputs or whatever you want to store or send, and LOCAL VARIABLES to store that data. i set a "SEND BUTTON" and a new client action, inside a new server action within the automatic exposed process from the core, and then set the inputs that the email is expecting from the locals and it should be ready. 


 


Automatization.oap
2023-08-24 15-18-41
ANDRES MAYR

Hey Max, let me try to understand. 


What about if you just set and server action (email) by the end of the flow ?

the email is like an a confirmation ? Like, "Thanks for your registration , your profile number is ...." 

2020-07-02 13-32-59
Max de Groot

Hi Andres,

Yeah the email is like a confirmation. It will be send out to another user who has been selected to complete the next phase. I want to accomplish this without any save and submit buttons to keep the flow quick and easy. For this reason it would be good to delay the email instead of sending out directly in case someone selects the wrong user. 

Another option is of course to do use a save and submit kinda button, but I want to see if this is possible without.

2023-08-24 15-18-41
ANDRES MAYR

So you need to set up an server action , with email sender, and that action set up a timer, by the end on the flow trigger the timer, 15 min, and that will trigger the email sender. 

btw , did you set up how to send emails from reactive ? 


2021-11-24 11-38-48
Luís Cruz
Solution

@Max de Groot read also about BPT and Light BPT.

With something like this you can get what you want.




2023-08-24 15-18-41
ANDRES MAYR

i am not in need is Max, please check this mate. 

2021-11-24 11-38-48
Luís Cruz

I misunderstood, I thought the question"did you set up how to send emails from reactive ? " was a doubt of yours, sorry mate my fault :)

2020-07-02 13-32-59
Max de Groot

Hi Luis,

I already though about this and your solution looks very promising. The problem is that I am using a Service Module as core module where the action of creating or updating the record takes place. This means that this is not available in the client side where my email logic is situated. So it seems I am unable to trigger the automatic process. 

Do you have any idea if exposing the CreateUpdate action from the core will be 'visible' enough for the client side to trigger the automatic process? I can try this tomorrow but maybe you know the answer or another solution to this problem. 

Thanks! 


Max

2020-11-13 07-48-15
Khuong Truong

Hi Max,

You can write a public Save server action in your core module. Inside your Save action you can call the built-in Create<Entity> or CreateOrUpdate<Entity> or Update<Entity>. This way can trigger automatic process.

Regards,

Khuong

2021-11-24 11-38-48
Luís Cruz

Hey,

Like Khuong said.

Another way is to have a Entity on the core that you add a record to send email, with a CreatedOnDateTime attribute (and others that you know better).

On the email module, a Timer checking every minute if there are new records on the table to send emails after 15 minutes of the CreatedOn.


But still, not the best aproach imo...

2023-08-24 15-18-41
ANDRES MAYR

This may help you : 

Please check the app. 

overall you need to : 

1 . on the core layer  : set the automatic process with : addminutes(currdatetime(),15) parameter and any detail. set as INPUTS the parameter that the Email is going to receive from the cliente. in the attached, i just set 2 parameters.  REMEMBER THAT EMAIL MUST BE SET IN TRADITIONAL WEB , REACTIVE DOESNT SEND EMAILS. 

2. expose process as public same for the email. 

3. in the end user layer : crear the inputs or whatever you want to store or send, and LOCAL VARIABLES to store that data. i set a "SEND BUTTON" and a new client action, inside a new server action within the automatic exposed process from the core, and then set the inputs that the email is expecting from the locals and it should be ready. 


 


Automatization.oap
2020-07-02 13-32-59
Max de Groot

Hi All,

Thanks for answering and following up on this topic. I was able to implement an automatic process and send the email after 15 minutes. 

@Andres Mayr Araya You are able to send emails from reactive since the last update. Check this link. It is still in Technical Preview mode but it works fine for us! 


2023-08-24 15-18-41
ANDRES MAYR

Yeah, I know. Sinces is a technical Previews it's just for testing but yes, works great. 


Well, happy to read that. 


Cheers ! 



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