Only specific group can close incident based on business service

Alex Saager1
Tera Contributor

Hello,

 

I have a requirement for only a specific assignment group to be able to close an incident based on conditions such as a business service, what's the best way to achieve this?

 

Many thanks,

 

Alex

6 REPLIES 6

Hi @Alex Saager1 ,

 

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

    // Check conditions (e.g., business service) for closure

    if (current.u_business_service.support_group == current.assignment_group && gs.getUser().isMemberOf(current.assignment_group.toString())) {

        // Conditions met, allow closure

    } else {

        // Conditions not met, prevent closure and show a message

        current.setAbortAction(true);

        gs.addErrorMessage("Incident cannot be closed due to invalid business service.");

    }

 

})(current, previous);

 

Can u try this n check please.

 

Thanks,

Danish

 

Alp Utku
Mega Sage

I would create client script on Incident table to make state field read only except specific assignment group and business service. The sample code is below

 

 

var grp = g_form.getValue('assignment_group') ;

var srvc = g_form.getValue('business_service') ; 

// make sure to use correct field names

if( grp == 'sys_id_of_assignment_group' && srvc =='the_value_of_business_service') {

g_form.setReadOnly('state',false) ;

} else 

g_form.setReadOnly('state',true) ;