We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

On change of Type field of user Group, need to create ticket

Anusha Anus
Tera Expert

Hi @Ankur Bawiskar , @sujitha16 , @BradBrad 

 

If Computer table  Support group's type changes and it contains some type ''Access'  and group type is not changed to same 'Access' role. Then I have to show alert on computer table.

I used BR I just added supportgroup.type changes, but that BR is not triggered after I  changed group's type to some other  type. Here type filed is List type.
Please suggest on it.

AnushaAnus_0-1726050250117.png

 

Thanks,

Anusha.

1 REPLY 1

Sid_Takali
Kilo Patron

Hi @Anusha Anus Create Before Update BR and below code. Add a BR run condition as Support Group.Type Changes and modify accordingly 

 

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

    if (current.support_group.changes()) {
        // Retrieve the new and previous values of the Support Group type
        var newGroupType = current.support_group.getDisplayValue(); 
        var oldGroupType = previous.support_group.getDisplayValue(); 

        if (newGroupType == 'Access') {
            if (oldGroupType != 'Access') {
                gs.addErrorMessage("The Support Group type has changed to 'Access', but was not previously 'Access'.");
            }
        }
    }

})(current, previous);