Populate approval time in sysapproval_approver table

Community Alums
Not applicable

Hello ServiceNow family,

Greetings of the day!

 

I wanted to populate approval time (for RITM)(When the request is approved or rejected (Date and time)) in the sys_approval_approver table.

I have checked and found that there is no OOB functionality.

I have created a field in the approval table named 'approved on'. But unable to populate approval date and time in it.

Please any one suggest me how I can do this task.

 

Best Regards,

Rajesh Mishra

 

1 ACCEPTED SOLUTION

Anand Kumar P
Giga Patron
Giga Patron

Hi @Community Alums ,
Create after update business rule on sys_approval_approver table 

 

 

(function executeRule(current, previous) {
    if (current.state == 'approved' || current.state == 'rejected') {
      var gDate = new GlideDate();
              current.setValue('approved_on', gDate);
            }
       
})(current, previous);

 

 

Please mark it as helpful and solution proposed if it works for you .

Thanks,

Anand

 

View solution in original post

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @Community Alums ,
Create after update business rule on sys_approval_approver table 

 

 

(function executeRule(current, previous) {
    if (current.state == 'approved' || current.state == 'rejected') {
      var gDate = new GlideDate();
              current.setValue('approved_on', gDate);
            }
       
})(current, previous);

 

 

Please mark it as helpful and solution proposed if it works for you .

Thanks,

Anand