How to change status automatically (OPEN to CLOSED) when date is reached?

Hi all,

I have built Recruitment App. It has offerJob(use to store all record offer) entity that include AvailableEndDate attribute and Status attribute.

 I want to update automatically value attribute "Status" from "Open" to "Closed" when offerJob records reach their AvailableEndDate. After that, candidate will no longer to see and apply that jobOffer.

Is there any mechanism in OutSystem help me to achieve this? I know I can use Timer to check date daily but it cost quite much system resource.


Thank you,

Huy

Why does it cost quite much system resource? Do you have any specific measurements to support your use case?


You can achieve that with BPT as well. Just check the WAIT activity, for instance.


Cheers!

Hi Huy,

Steps to achieve 

1) Add the another attribute "UpdatedOn" to the entity.

2) Then on the page preparation first check the Updatedon is present date or not.

3) If the UpdatedOn is not the present date then filter the data with AvailableEndDate = Currdate().

4) Update the filtered data records status from open to close.

5) Update the last attribute UpdatedOn to current date.

6) Then filter the data based on the status open.


The steps from 2 to 5 will happen only once in the day for the first user. It is the alternative for the timer.Hope it will helps you.

Regards,

Koushik


Koushik Prathi wrote:

Hi Huy,

Steps to achieve 

1) Add the another attribute "UpdatedOn" to the entity.

2) Then on the page preparation first check the Updatedon is present date or not.

3) If the UpdatedOn is not the present date then filter the data with AvailableEndDate = Currdate().

4) Update the filtered data records status from open to close.

5) Update the last attribute UpdatedOn to current date.

6) Then filter the data based on the status open.


The steps from 2 to 5 will happen only once in the day for the first user. It is the alternative for the timer.Hope it will helps you.

Regards,

Koushik


I strongly advise against this. There is unnecessary burden for the end users, even if the "update of the old records" only happens once.

This is clearly a chapter of "When to use Timers" book.

Hi Huy Nguyen,

I am thinking of a simple solution. Since you already have the AvailableEndDate, my suggestion will be to use is to create some kind of validation.

For example. (just some sample implementation)

I can wrap my 'apply to job' within an if condition that will compare AvailableEndDate with current date. 

Hope this can be of help to you :)

Armando Gomes wrote:

Why does it cost quite much system resource? Do you have any specific measurements to support your use case?


You can achieve that with BPT as well. Just check the WAIT activity, for instance.


Cheers!

Hi Armando Gomes,

I think if i use timer, it may run every second to check whether or not it is right time(AvailableEndDate), so it will cost much system resource.

About BPT,  can you give me some tutorial, example how to use BPT and WAIT activity to achieve above requirement?

Thanks,


You can set timer for daily,weekly,monthly(Even you can set with-in particular interval) bases. Timer will not run every second.

Pranav Pandey wrote:

Hi Huy Nguyen,

I am thinking of a simple solution. Since you already have the AvailableEndDate, my suggestion will be to use is to create some kind of validation.

For example. (just some sample implementation)

I can wrap my 'apply to job' within an if condition that will compare AvailableEndDate with current date. 

Hope this can be of help to you :)

Hi Pranav Pandey,


In this case, I want to update status automatically in entity base on checking AvailableEndDate with current datetime.

Thank for your help!


Solution

Huy Nguyen wrote:

Hi Armando Gomes,

I think if i use timer, it may run every second to check whether or not it is right time(AvailableEndDate), so it will cost much system resource.

About BPT,  can you give me some tutorial, example how to use BPT and WAIT activity to achieve above requirement?

Thanks,

If the AvailableEndDate is a Date and not a Date Time (which would make sense that all job openings end at the same time of different days, let's say midnight?), you just need to run it once daily.

There is the documentation and, of course, this masterclass.

Happy low-coding!

Solution