- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 03:52 AM
based on user date selection survey needs to trigger
if user selected start date is today then value2 needs to update 'Yes'
if the user selects end date is yesterday the valu2 needs to update 'NO'
please find variables details in screenshot
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 04:10 AM - edited 04-30-2024 12:27 AM
Hi @vinnus ,
You can use below script for your problem
var currentDate = new GlideDateTime();
var yesterdaydate = new GlideDateTime();
yesterdaydate.addDays(-1);
var gr = new GlideRecord('x_jj_dfit_dfit_system_variables'); // You can use any table as per your requirment
gr.addQuery('sys_id', '87b1682a0a0a2c3e75af785bd9073d70'); // You can give any query as per your requirment
gr.quer();
if(gr.next()){
if(gr.start_date == currentDate){ // Please give backend name of start date
gr.value_two = 'Yes'; // Set the value of value_two to true
}if(gr.endDate == yesterdaydate){
gr.value_two = 'No'; // Set the value of value_two to NO
}else{
gs.print('Wait ');
}
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 12:17 AM
Hi @vinnus ,
I did small mistake I wrote wrong speeling of gr.query() please correct that and it will work
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 04:05 AM
Table: x_jj_dfit_dfit_system_variables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 04:10 AM - edited 04-30-2024 12:27 AM
Hi @vinnus ,
You can use below script for your problem
var currentDate = new GlideDateTime();
var yesterdaydate = new GlideDateTime();
yesterdaydate.addDays(-1);
var gr = new GlideRecord('x_jj_dfit_dfit_system_variables'); // You can use any table as per your requirment
gr.addQuery('sys_id', '87b1682a0a0a2c3e75af785bd9073d70'); // You can give any query as per your requirment
gr.quer();
if(gr.next()){
if(gr.start_date == currentDate){ // Please give backend name of start date
gr.value_two = 'Yes'; // Set the value of value_two to true
}if(gr.endDate == yesterdaydate){
gr.value_two = 'No'; // Set the value of value_two to NO
}else{
gs.print('Wait ');
}
}
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 06:46 AM
Not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 12:17 AM
Hi @vinnus ,
I did small mistake I wrote wrong speeling of gr.query() please correct that and it will work
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak