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

Linda Kendrick
Kilo Guru

Here is a screen shot of what we are doing now. We want to automate the task to add/remove the user from the group.


Capture.PNG


To automate you need to capture the changes on the catalog first. If the details are there, you can replace the servicenow assignement group changes task with a run script and a normal gliderecord insertion/deletion should be enough to handle this


Exactly, ask all your questions on the catalog item, then bring those into the workflow to get approvals, then make the changes with a direct GlideRecord update.   We have a notion that a group has a bunch of roles, but that does not necessarily mean that all users in the group have all the roles the group has, so it gets more complicated.


Thanks Linda for the workflow share, this is great start to steer me to the right direction.



I was wondering if you had used two separate catalog items, one for adding and one for removing? Or have the questions been put into one catalog item and parsed to distinguish what action needs to be taken when creating the task?



Kalaiarasan P - Would you recommend a certain catalog "best practice" design or approach. Are there certain techniques that would be easier to add in the catalog in order to make the Workflow simpler? I have seen the add and remove "bucket" that is used for Roles and groups in out of box service now, can this be implemented into the catalog item as well?


You can use a list collector on catalog if multiple users need to be added or removed.



You don't really need 2 catalogs for this. Have a question first, if you want to add or remove the users. Based on the selection, show/hide other variables..



Just make sure, you drill down all the question on the catalog itself so that the workflow is simple and straight forward.