- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2019 02:46 AM
I have field u_date and need to check if the current date is greater to u_date by 15 min.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 04:26 AM
Okay. Then simply make the BR to display query instead of after insert.
Then your Br executes whenever you open the incident. And if the incident u_date+15 minutes is more than current date, then you can show the message saying
gs.addInfoMessage("Current date is greater than u_date");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2019 11:16 PM
I tried but no output..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2019 11:27 PM
Okay. where are you writing this code?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2019 11:34 PM
If you are writing in BR, then check by placing some logs.
//crate BR before insert on incident table.
var gd = new GlideDateTime(current.u_date); //cross check the field name.
gs.log("U Date is "+gd);
gd.addSeconds(900);
gs.log("U Date after adding 15 minutes is "+gd);
var gd1 = new GlideDateTime();
gs.log("current date/time is "+gd1);
if(gd1> gd) {
gs.print("current date is greater");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 01:44 AM
hello Asif,
I have written an on before insert BR...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 01:52 AM
Hi Asif,
Its the comparison or the if condition that does not work all other logs are coming.
Regards,
Sachu Pillai
Mark the comment as a correct answer and also helpful if this answers your question.