- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2022 10:13 PM
Hello Everyone.
My requirement is, need to compare with the current date and time with predefined date and time (Filled by user), if the current date and time breached or crossed the predefined date and time need to set the value on a text field 'yes' if not then set value 'no'.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 01:19 AM
Hi
Create OnLoad Client Script on Custom Table.
sample script:
var currentDate = new Date(); //Current Date
var plannedDate = new Date(gr.getValue('u_end_date')); //Planned End Date
if (currentDate.getTime() > plannedDate.getTime()) {
g_form.setValue('NameOFtheField','Yes');
} else{
g_form.setValue('NameOFtheField','No');
}
please change as per your requirement.
Please check and Let us know
Thanks 🙂
Shakeel Shaik 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 09:09 PM
Hi,
you can use simple client script as well for this without GlideAjax
Can you share your script used?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 11:13 PM
Hi,
In BR i am not sure how will you check the prefield date has been breached. What will be the condition to check this.
You can write a scheduled job and check there which will RUN when ever you set.
var Cdate = new GlideDateTime();
var gr = new GlideRecord('incident');
gr.addActiveQuery();
gr.query();
while(gr.next()){
var Fdate = gr.u_created_date;
if(Cdate > Fdate){
gr.check = 'true';
gr.update();
}
}
// Update the values accordingly
Thanks,
Sumit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 01:19 AM
Hi
Create OnLoad Client Script on Custom Table.
sample script:
var currentDate = new Date(); //Current Date
var plannedDate = new Date(gr.getValue('u_end_date')); //Planned End Date
if (currentDate.getTime() > plannedDate.getTime()) {
g_form.setValue('NameOFtheField','Yes');
} else{
g_form.setValue('NameOFtheField','No');
}
please change as per your requirement.
Please check and Let us know
Thanks 🙂
Shakeel Shaik 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 01:43 AM
Thank you.