Send to CAB manually

athavichith
Mega Sage

Hi everyone,

 

We’re looking to customize Change Management to allow Change Managers to manually trigger a CAB approval request on a Change Request—even when it doesn’t automatically flow into CAB via the standard state model. This is to meet our business needs where certain changes require a CAB review outside of the usual criteria.

 

What we’re trying to do
Create a UI Action that behaves like the OOTB “Request Approval” but specifically targets CAB approval (i.e., creates the CAB approval records and moves the Change into the correct state/stage as if CAB were requested via state model rules).

 

What I tried
I created a client-side UI Action as a copy of the OOTB “Request Approval” and wired it to the state model action key.  But everytime I try to run this, I get "Action not authorized".  Here’s the script:

function sendtoCAB(){
    g_form.setValue("state", "-3");
    gsftSubmit(null, g_form.getFormElement(), 'state_model_request_cab_approval');
}

if (typeof window == 'undefined')
   updateAndRedirect();

function updateAndRedirect() {
    current.update();
    action.setRedirectURL(current);
}




1 ACCEPTED SOLUTION

Matthew_13
Mega Sage

Hi Buddy,

You’re hitting “Action not authorized” because a state model action key isn’t just a command you can call. The state model checks whether that action is allowed from the change’s current state and sometimes based on roles/conditions. If the model doesn’t allow “Request CAB approval” from where you’re clicking, it rejects it.

Also: setting state on the client doesn’t really help. The server-side state model still evaluates authorization and transitions based on what’s valid, not what you tried to force in the form.

What to do instead:

  • Stop forcing the state (g_form.setValue("state","-3")).

  • Keep the submit, but only if the state model is configured to allow it:

function sendtoCAB() {
  gsftSubmit(null, g_form.getFormElement(), 'state_model_request_cab_approval');
}

Then the real fix:

  • Go to the Change Request state model and add/allow the “Request CAB approval” action from the states you want managers to be able to trigger it from (Assess, Authorize, Scheduled, etc.). Until you do that, the platform will keep saying “not authorized.”

One more quick gotcha I seen:

  • Make sure you didn’t clone the OOTB UI Action and leave the same Action name. If two active UI Actions share the same action name, you can get weird authorization behavior. Rename your custom one.

Bottom line: the button isn’t the issue—the state model permissions are.

 

@athavichith - Please mark Accepted Solution and Thumbs Up if you find Helpful!

MJG

View solution in original post

2 REPLIES 2

VaishnaviK3009
Tera Contributor

Hi @athavichith !!

 

Why this happens

  • CAB approval is controlled by the Change State Model

  • State model actions can only run on the server

  • Client-side UI Actions (gsftSubmit, g_form.setValue) cannot trigger CAB

  • Admin works in some cases, but non-admin users will always be blocked

This is expected behavior, not a bug.

 

Simple & Correct Solution
Create a server-side UI Action and let the state model do the work.

Server-side UI Action script:

var sm = new ChangeStateModelEngine(current);
sm.processAction('request_cab_approval');
action.setRedirectURL(current);

That’s it.

Why this works

  • CAB approval records are created automatically

  • Change moves to the correct state/stage

  • CAB Workbench is updated correctly

  • No hard-coding of states or approvals

Important:-

  • Do NOT set the state field manually
  •  Do NOT try to call state model actions from the client
  •  Always trigger CAB via the state model (server-side)

Mark this as Helpful if it clarifies the issue.
Accept the solution if this answers your question.

Regards,
Vaishnavi
Associate Technical Consultant

Matthew_13
Mega Sage

Hi Buddy,

You’re hitting “Action not authorized” because a state model action key isn’t just a command you can call. The state model checks whether that action is allowed from the change’s current state and sometimes based on roles/conditions. If the model doesn’t allow “Request CAB approval” from where you’re clicking, it rejects it.

Also: setting state on the client doesn’t really help. The server-side state model still evaluates authorization and transitions based on what’s valid, not what you tried to force in the form.

What to do instead:

  • Stop forcing the state (g_form.setValue("state","-3")).

  • Keep the submit, but only if the state model is configured to allow it:

function sendtoCAB() {
  gsftSubmit(null, g_form.getFormElement(), 'state_model_request_cab_approval');
}

Then the real fix:

  • Go to the Change Request state model and add/allow the “Request CAB approval” action from the states you want managers to be able to trigger it from (Assess, Authorize, Scheduled, etc.). Until you do that, the platform will keep saying “not authorized.”

One more quick gotcha I seen:

  • Make sure you didn’t clone the OOTB UI Action and leave the same Action name. If two active UI Actions share the same action name, you can get weird authorization behavior. Rename your custom one.

Bottom line: the button isn’t the issue—the state model permissions are.

 

@athavichith - Please mark Accepted Solution and Thumbs Up if you find Helpful!

MJG