- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 07:09 AM
I have the current situation. I want to compare the Scheduled On date to the current date/time and when it matches or supersedes it, the state will switch to 'send-ready'. The business rule script is below.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('x_uno15_nrapp_push_notification');
gr .addEncodedQuery('scheduled_onISNOTEMPTY');
gr .query();
var scheduled = new GlideDateTime(getValue('scheduled_on'));
var nowdatetime = new GlideDateTime();
while (gr .next()) {
if (scheduled >= nowdatetime)
{
gr .setValue('state', send-ready);
gr .update();
}
}
})(current, previous);
Thanks.
Jason
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 07:39 AM
What's your trigger? Why not create a flow for this? Put in a wait until the time you define and then let it do it's magic.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 07:39 AM
What's your trigger? Why not create a flow for this? Put in a wait until the time you define and then let it do it's magic.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2024 08:07 AM
Because I was stuck in Business Rules - The flow designer worked because the condition has "from now" option where the business rule logic only had "ago"
The wait condition rule that worked was 'scheduled_on' relative before 1 min from now.