Add approval button on CAB Workbench

Khyati Panchal1
Tera Contributor

Hello,

I need help adding Approval Button on CAB Workbench.

Leads would be appreciated.

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage
Kilo Sage

Hi @Khyati Panchal1 ,

 

Hope you are doing great.

 

To add Approval Button on CAB Workbench, we need to create custom UI action:

  1. create a new UI Action.
  2. Fill in the required details, and atble and provide on click function.
  3. in script define on click function with scripting capabilities

 

// Sample script to handle approval logic
var gr = new GlideRecord('change_request');
gr.get(current.sys_id);

if (gr.canApprove()) {
    gr.approve();
    gs.addInfoMessage('Change request approved successfully.');
} else {
    gs.addErrorMessage('You do not have the required permissions to approve this change request.');
}
​

4. Save the UI Action.

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

View solution in original post

1 REPLY 1

Riya Verma
Kilo Sage
Kilo Sage

Hi @Khyati Panchal1 ,

 

Hope you are doing great.

 

To add Approval Button on CAB Workbench, we need to create custom UI action:

  1. create a new UI Action.
  2. Fill in the required details, and atble and provide on click function.
  3. in script define on click function with scripting capabilities

 

// Sample script to handle approval logic
var gr = new GlideRecord('change_request');
gr.get(current.sys_id);

if (gr.canApprove()) {
    gr.approve();
    gs.addInfoMessage('Change request approved successfully.');
} else {
    gs.addErrorMessage('You do not have the required permissions to approve this change request.');
}
​

4. Save the UI Action.

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma