How to update the work notes time with todays time

Datta Pisal
Kilo Explorer

Hi All,

I have written a fix script to update the state and work note of catalog task but it is updating the work notes with the older time not with todays time.

Could you please help me to update it with todays time.

image

var TSK = new GlideRecord('sc_task');
TSK.addEncodedQuery("active=true^sys_created_on<javascript:gs.beginningOfLast6Months()^stateNOT IN3,4");
TSK.query();

 

while (TSK.next()) {

 

TSK.setWorkflow(false);
TSK.Active = false;
TSK.state = 4;
TSK.work_notes = "This task has been automatically closed due to exceeding SLA by 6 months.";
TSK.update();

 

}

 

Regards,

Dp

7 REPLIES 7

Filipe Cruz
Kilo Sage
Kilo Sage

Hello zazaza,

The usage of setWorkflow(false) statement prevents the addition of work notes, as well as suppresses the execution of business rules and notifications.

If you want to generate a new work note, you need to remove the setWorkflow(false) statement.

Please mark my answer as correct and helpful if it is relevant for you!

Thanks,

Filipe Cruz

Thank you for reply!!

But is there any syntax to update that field?

 

Regards,

Hello zazaza, You want to update an already existing work note?

Hi,

I want modify the above code so can using some syntax I can update work note field timing as well.

 

Regards,