Creating Workflow to add and remove users from assignment groups

aismail
Kilo Contributor

Hello All,

I am fairly new to ServiceNow and continuously learning new skills and techniques everyday. I have just begun working with Workflows and had a quick question. I am looking to build a slight automation process for users, and was wondering if anyone has experienced a similar build. You insight is much appreciated.

How i am thinking it should work:

1. Catalog item is created where users can request if they want to be removed or added to a group.

2. If they are requesting to be removed, it just automatically removes them (no approval)

3. If they are requesting to be added to a group, an approval is sent out to group manager

4. If group manager accepts, user is added to group and notification is sent out. If rejected then a notification is sent and request is closed.

Is there a better process/design? Any Technic or skills that would help? How would one automate the addition and removal of users? What would be a good place to start in regards to best practice and creating the workflow.

I have tried looking for online resources but couldn't find anything specific to assignment groups. If anyone knows of any resources available, that would be great!

Thanks

1 ACCEPTED SOLUTION

randrews
Tera Guru

i do it also... just a script to add a row to the table.. like below   the flush messages keeps the person who approves the record from seeing any add info messages triggered by the script... the current. comments updates the requested item with the note.



this is in a run script block after the mark as approved item.





addtogroup();



function addtogroup(){


    var newgrpmember = new GlideRecord('sys_user_grmember');


    newgrpmember.user = current.variable_pool.requested_for;


    newgrpmember.group = current.variable_pool.v_member_group_new;


    newgrpmember.update();


    gs.flushMessages();


    current.comments += '\n' + "Added to group " + newgrpmember.group.getDisplayValue();


    current.update();


}


View solution in original post

29 REPLIES 29

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could definitely do this with a catalog item and some run script activities in your workflow. I think the main question would be are you managing groups/users through ServiceNow or an external tool like AD? Might be a little more complex if you're using AD to manage memberships.


Yes you are correct, my first objective is just simply managing groups within ServiceNow.


We do this exact thing.   We allow any user to modify a group, including membership (add or remove).   All modification requests go to the manager of that group to approve.   We use a catalog item that goes to a workflow that controls the process.   It gets the approvals necessary, then does the modification after that is done and sends out any necessary communication.


Did you use a Run Script in the workflow?