make Calendar Date/Time field empty

Shir Sharvit
Tera Contributor

Hi

I have created a form with Calendar Date/Time field.

How to make this field empty when the date and time specified in it arrives.

ShirSharvit_0-1702463213211.png

 

This is the field type:

ShirSharvit_1-1702463239083.png

 

 

10 REPLIES 10

Tai Vu
Kilo Patron
Kilo Patron

Hi @Shir Sharvit 

What's your use case behind this description "make this field empty when the date and time specified in it arrives."

 

Cheers,

Tai Vu

Later, I will also create a reminder email that will be sent to the assigned to to perform the task.
Right now I need to make the field empty when the specified time has arrived and the reminder has been sent.

I have tried this business rule but it is doesnt work

ShirSharvit_0-1702464431795.png

 

Hi @Shir Sharvit 

Okay got it now.

Business Rule may not be the most suitable approach since it triggers based on database actions. So that means a record will never clear the Reminder date unless there's some action on that record have performed.

To automatically clear the Reminder Date field when it's in the past, you can create a scheduled job that runs on a daily basis. Below is a sample script that you can use in the scheduled job:

1. Create a schedule job that runs on a daily basis.

2. Sample script execution.

 

var gr = new GlideRecord('u_quality_event');
gr.addNotNullQuery('u_reminder_date_and_time');
gr.addQuery('u_reminder_date_and_time', '<=', new GlideDateTime());
gr.query();
gr.u_reminder_date_and_time = '';
gr.updateMultiple();

 

 

Cheers,

Tai Vu