Only the change manager should be able to cancel an change at the Assess state

Sairam3697
Tera Contributor

I have a  scenario where only a change manager should be able to cancel the change at the assess state.

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Sairam3697 Here is how you can handle it via business rule

Screenshot 2024-06-14 at 8.13.27 PM.pngScreenshot 2024-06-14 at 8.15.35 PM.png

Here is the script.

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (!gs.hasRole('change_manager')) {
        current.setAbortAction(true);
        gs.addErrorMessage('Only user with change manager role can cancel the change in assess state');
    }

})(current, previous);

View solution in original post

2 REPLIES 2

Yashsvi
Kilo Sage

Hi @Sairam3697,

you can use onload client script if user has "change_manager" role, at accordingly set the state field to read only.

You can use this logic provided below.

if (!g_user.hasRole('change_manager')) {
        g_form.setReadOnly('state', true); // Replace state with backend value of state field.
    }

Thank you, please make helpful if you accept the solution. 

 

Sandeep Rajput
Tera Patron
Tera Patron

@Sairam3697 Here is how you can handle it via business rule

Screenshot 2024-06-14 at 8.13.27 PM.pngScreenshot 2024-06-14 at 8.15.35 PM.png

Here is the script.

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (!gs.hasRole('change_manager')) {
        current.setAbortAction(true);
        gs.addErrorMessage('Only user with change manager role can cancel the change in assess state');
    }

})(current, previous);