Add an hour to time field in incident form
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2025 11:22 AM
i am trying to add an extra hour in time in time field but i face some problem .
this is my code running on before update
(function executeRule(current, previous /*null when async*/) {
var gt = new GlideTime(current.u_customtime);
var newTime = gt.addSeconds(300);
current.setValue('u_customtime', newTime);
})(current, previous);
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2025 02:24 AM
syntax is different, this should work fine
1) you should use GlideDateTime
2) addSeconds() doesn't return anything
(function executeRule(current, previous /*null when async*/ ) {
var gt = new GlideDateTime(current.u_customtime);
gt.addSeconds(3600); // 1 hour is 3600 seconds
current.setValue('u_customtime', newTime.getValue());
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2025 09:31 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.