we want to display info message on change request, if any approver is Inactive in system

Sateesh9
Tera Contributor

Hi All,

we want to display info message on change request, if any approver is Inactive in system.

Approvals were triggered at Authorize and review state and waiting for multiple group approvals.

my requirement is: if any approver is Inactive during the approval process, when ever change request is open, need to display message on the top of the form.

 

Thanks,

Sateesh

1 ACCEPTED SOLUTION

// This script runs when the change request form is loaded
addLoadEvent(function() {
// Get the current change request's sys_id
var changeRequestSysId = g_form.getUniqueValue();

// Query the sysapproval_approver table for related approvals
var approvalGr = new GlideRecord('sysapproval_approver');
approvalGr.addQuery('sysapproval', changeRequestSysId);
approvalGr.query();

// Check each approval for inactive approvers
while (approvalGr.next()) {
var approverId = approvalGr.approver;
var approverGr = new GlideRecord('sys_user');
if (approverGr.get(approverId) && approverGr.active == false) {
// If an inactive approver is found, display an info message
g_form.addInfoMessage('One or more approvers are inactive. Please update the approvers.');
break; // Exit the loop after finding the first inactive approver
}
}
});

View solution in original post

5 REPLIES 5

Hi 

can you please help me on this,

Need to populate next periodic review date based on periodic review frequency selection.

table name: cmdb_ci_service_auto

Periodic review frequency is dropdown field with choices 2 years, 3 years and 4 years.

next periodic review is a date filed.

if we select 2 years, then next periodic review should be populating date as 2 years from today.

if we select 3 years, then next periodic review should be populating date as 3 years from today.

if we select 4 years, then next periodic review should be populating date as 4 years from today.

 

please find the attachment for your quick reference