How should I set to enter "Planned start date + 2hours" in the Change Task(change_task)'s DueDate?

ayano
Giga Guru

What settings will make the Change Task (change_task)'s DueDate auto-fill?

 

I want to set to enter "Planned start date + 2hours" in the Change Task(change_task)'s DueDate.
How should I set?

 

 

7 REPLIES 7

HI @ayano 
"3600000" are the milli seconds to be added for one hour.
1 Hour = 60 Minutes * 60 Seconds * 1000 Milli Seconds.
For N Hours = N* 60 Minutes * 60 Seconds * 1000 Milli Seconds.

For example for 2 hours-
For 2 Hours = 2* 60 Minutes * 60 Seconds * 1000 Milli Seconds.

C

If the provided solution meets your needs, kindly consider marking it as helpful and accepting it as the solution. This helps others who may have similar questions.




Thanks and Regards,

Saurabh Gupta

@ayano 

C

If the provided solution meets your needs, kindly consider marking it as helpful and accepting it as the solution. This helps others who may have similar questions.


Thanks and Regards,

Saurabh Gupta

SunilKumar_P
Giga Sage

Hi @ayano, You can try creating a Business rule of type before insert on change_task table.

 

(function executeRule(current, previous /*null when async*/ ) {

    if (current.change_request.start_date != '') {
        var start_date = new GlideDateTime(current.change_request.start_date);
        var hours = 2;
        start_date.addSeconds(hours * 60 * 60);
        current.due_date = start_date;
    }

})(current, previous);
 
Regards,
Sunil