RITM approval date

Sristi
Tera Contributor

Hi,

Need to get the RITM approval date value for a request. The RITM's approval date is not updated in 'Approval set' field.

Any other field where the RITM approval date is saved ?

 

Please suggest.

 

Thank you.

2 REPLIES 2

Anand Kumar P
Giga Patron
Giga Patron

Hi @Sristi ,

The approval date for a Requested Item (RITM) is stored in the sysapproval_approver table, particularly within the sysapproval field. This table is responsible for tracking approval records and recording their respective approval dates. 
Run below script with ritm sys_id in background script in lower instance then you will get the date of approved.

AnandKumarP_0-1698396053686.png

 

 

 

 

var ritmSysID = 'd03318cd2ff1311056a7c786f699b631';
var approvalGr = new GlideRecord('sysapproval_approver');
approvalGr.addQuery('sysapproval', ritmSysID);
approvalGr.addQuery('state', 'approved');
approvalGr.query();
if (approvalGr.next()) {
    var approvalDate = approvalGr.sys_updated_on.getDisplayValue();
    gs.info('Approval Date for RITM: ' + approvalDate);
} else {
    gs.info('No approval date found for the RITM.');
}

 

 

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

Thanks,

Anand

Suyog Aptikar
Giga Guru

@Sristi there is another field on sc_req_item called 'approval', this field value is 'requested' for me even if RITM is approved hence 'approval set' is not getting populated, not sure if this is OOTB issue, but if you  add a logic to update value to 'approved' once RITM is approved then approval set will be autopopulated with timestamp at which you update it and you can use it for further processing.

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.



Best regards

Suyog