Setting a date-time field based another date-time field

Jamsta1912
Tera Guru

Hello all,

I'm struggling with something fairly basic. In a business rule, I want to set the value of a date-time field to be 15 minutes in the future compared with the value of another date-time field on the same record. What's the best way to do this?

Thanks

Jamsta.

1 ACCEPTED SOLUTION

John VanBruggen
Giga Guru

Hi there,


Here is something I wrote up that adds 15 minutes to a time.


====================================================


//Current Time


var ctime = current.opened_at;



//Future Time + 900 seconds (15 minutes)


var ftime = new GlideDateTime(ctime);


ftime.addSeconds(900);


answer = ftime;



====================================================



The script example above is for a calculated value in a field (shown below).   You can easily adopt it to a business rule.



dt stamp.png



Hope that helps!


Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

View solution in original post

2 REPLIES 2

John VanBruggen
Giga Guru

Hi there,


Here is something I wrote up that adds 15 minutes to a time.


====================================================


//Current Time


var ctime = current.opened_at;



//Future Time + 900 seconds (15 minutes)


var ftime = new GlideDateTime(ctime);


ftime.addSeconds(900);


answer = ftime;



====================================================



The script example above is for a calculated value in a field (shown below).   You can easily adopt it to a business rule.



dt stamp.png



Hope that helps!


Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

Thank you John. This is perfect