Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Assignment Group in workflow based on User profile selection of "location"

HenryD
Tera Guru

Hello,

 

I've come across a scenario where I need the assignment group to be based on what the user has populated based on the User profile. trying to script in the "Create Task" at the bottom.

 

example: if user has Volume1 selected in User profile, please assign to Volume 1 Group. If user has Volume2 selected in User Profile, please assign to Volume2 Group. 

 

I can set the assignment group within the task but for this scenario i need to script to differ based on user profile.

 

any suggestions or feedback is appreciated or help docs i can refer

8 REPLIES 8

i do need help on the script if you can assist, i am pulling from the user profile table (sys_user) i know that and i want based on choice selection from user table to populate the assignment group either "Volume1" or "Volume2".  would i be using an IF else script? 

Are you talking about in a workflow?  Like a catalog task inside a workflow for a request of some sort?

 

There is a script section at the bottom of catalog task in a workflow where you can set the assignment group via script.  

 

It's simple and something like (using user_profile_group as an example of the group field on the user profile):

task.assignment_group = current.requester.user_profile_group

or

task.assignment_group = current.opened_by.user_profile_group


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

hello steven , thank you for your inputs.

 

im getting confused, so say if user has "Volume1" in their user profile and once they submit a request, what i want my script is to the first stage to assign it to is "Volume1 stage1" 

 

will i put task.assignment_group= current.requester.volume1 ? 

i currently have this but doesnt seem to be working, if you can guide me i feel like im close

 

if (current.variables.location_base == 'fe5e195b1b0c3d1091c5a820f54bcbb3') { //sys_id for volume 1 choice user profile
task.assignment_group = '536e365e1b4c791091c5a820f54bcb0e'; //sys_id for VOlume1
} else if (current.variables.location_base == 'c26ed55b1b0c3d1091c5a820f54bcb5a') { //sys_id for Volume2 choice in user profile
task.assignment_group = 'ceae769e1b4c791091c5a820f54bcb4d'; //sys_id for VOulme 2 group