How can I add seconds to a GlideRecord value?

Simon Ciglia
Giga Guru

Dear SNC,

how can I add seconds with Gliderecord to an existing record?

 Idea

var gr = new GlideRecord("incident");
gr.addQuery("sys_id", "9b8eb0c94f71f20022c92eff0310c222");
gr.query();
if (gr.next()) {
gr.overdue = gr.overdue.addSeconds(3600);
gr.update;
}

 

Thank you in advance,
Simon

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Try this code. This will work.

var gr = new GlideRecord("incident");
gr.addQuery("sys_id", "9b8eb0c94f71f20022c92eff0310c222");
gr.query();
if (gr.next()) {
var gdt = new GlideDateTime(gr.overdue);
gdt.addSeconds(3600);
gr.overdue = gdt;
gr.update;
}

Mark the comment as correct/helpful if it helps to solve the problem.

View solution in original post

6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

@Simon Ciglia Are you sure the one you marked correct worked for you?

As it seems to have an typo for gr.update which should be gr.update()

Note: You can have only 1 answer correct so mark the one that you found more helpful & would help future readers to be benefitted from.

I saw that typo, thank you very much!