How to use toggle script. I need to set automatic onhold in SCTASK in 30days

Jeck Manalo
Tera Guru

I am trying to create script to automatic set the onhold into 30days how can it be possible on the workflow using toggle script ?

 

find_real_file.png

1 ACCEPTED SOLUTION

Hello Jeckson,

So you should be able to set this field as per the script provided above. If you field is of Date type then you can use the below script:

var nd= new GlideDateTime(gs.nowDate());
var fd = new GlideDateTime(nd);
fd.addDays(30);
var dueDate = fd.getDate();
return dueDate;

This is what I have used and the due date is getting set on RITM table. do you want to set the on hold date 30 days later based on some other field value?

find_real_file.png

find_real_file.png

Please mark my respsone as helpful/correct, if it answer your question.

Thanks

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use Wait for Duration logic and give 30 days and then update the state

regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

let catalog task be created but you can update the state after 30 days

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

We have this variable which we use to onhold the sctask and it also reflect to ritm.

I need to automate it  to hold in 30days when the specific sctask trigger.

 

find_real_file.png

Okay I took it otherwise.

you can use this inline script

var gdt = new GlideDateTime();
gdt.addDaysUTC(30);
return gdt.getDate();

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader