Business Rule

yardenKrispel
Tera Contributor

I need help! I have a notification that I send an event and Business Rule to and the code works partially but the assignment_group does not work for me and the goal is that as soon as there is a group then the notification will be sent to the members of the group is there a possibility that someone could correct the code for me in these lines? Thanks!!

 

yardenKrispel_0-1702459053029.png

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Assignment group is not an array, it is a reference field that holds a single sys_id from the sys_user_group table.  If you have the Group email field populated on your groups, use the same syntax as assigned_to.  If you are not using this field and want to trigger the event to each member of the group, you would need something like this:

} else if (current.assignment_group) {
    var userIds = new Array();
    var userGR = new GlideRecord('sys_user_grmember');
    userGR.addQuery("group", current.assignment_group);
    userGR.query();
    while (userGR.next()) {
        userIds.push(userGR.user.toString());
    }
    for (var i=0; i<userIds.length; i++) {
        

 then use userIds[i].email.toString() in your event call