I have field u_date and need to check if the current date is greater to u_date by 15 min.

sachujayakumar
Kilo Contributor

I have field u_date and need to check if the current date is greater to u_date by 15 min.

1 ACCEPTED SOLUTION

 

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 the comment as a correct answer and also helpful if this answers your question.

 

View solution in original post

21 REPLIES 21

I tried but no output..

 

Okay. where are you writing this code? 

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");
}

 

hello Asif,

I have written an on before insert BR...

sachujayakumar
Kilo Contributor

Hi Asif,

Its the comparison or the if condition that does not work all other logs are coming.

 

Regards,

Sachu Pillai