I have to assign user in assigned to field based on field value in catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 03:54 AM
Hi,
I have to assign user in assigned to field based on field value in catalog item. I have catalog item and in that there is variable called 'ABC' that is a select box field and it is having values 1, 2, 3, 4, 5, 6 and when user submit request for that it generate 4 catalog task one after closing another task. First task assigned to 'L1 group', Second task assigned to 'L2 group', Third task assigned to 'L3 group' and Fourth task assigned to 'L4 group'.
When user submitting request and user select '1' value in ABC field then it should assign First Task to 'Nora', if user select '2' in ABC field then it should assign First Task to 'Neemat'.
When user submitting request and user select '2' value in ABC field then it should assign Second Task to 'Digambar', if user select '2' in ABC field then it should assign First Task to 'Sahabas'.
It is assigning based on field value selection in 'ABC' when user submit request and assigned to user in task.
I'm using flow for that.
Do I need to write script to assign user in assigned to script.
Can anyone please help me with that.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 04:39 AM
Hi @niveditakumari
Yes, You need to write a Inline script for Assigned to Mapping
var res = fd_data._1__get_catalog_variables.confirm; //use proper variable name here.
if(res == 'A')
return 'sys_id_of_user'; //Store user sys_id in property and get it here.
else if(res == 'B')
return 'sys_id_of_user';//Store user sys_id in property and get it here.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 05:07 AM
You can use flow variable of type string and use "Set Flow Variable" flow logic to set that with the user sysId
Then use this flow variable and it will be populated in the Assigned To field
Something like this in flow variable
var val = fd_data._1__get_catalog_variables.selectBoxVariableName; //use proper variable name here.
if(val == '1')
return 'user1SysId';
else if(val == '2')
return 'user2SysId';
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 08:01 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 07:07 AM - edited 04-18-2025 07:12 AM
Hello @niveditakumari ,
I would recommend not to hard code the approvers in the Flow script. With 6 options and 4 tasks you would have 24 different combinations and 24 sys_ids to hard code. That is not a maintainable solution.
Keep the assignment logic outside of the Flow and use "Assignment rules" instead.
Here is an example that I tested successfully on my end:
- In the Flow, just create the Catalog Tasks and give each one a unique Short description. Don't assign them to groups or users here.
- Create an Assignment Rule, like this:
If you do not see the "Variables" option please select "Show related fields" and then open the choice list again.
- Create the remaining Assignment Rules in the same fashion:
You will end up with a rule set that is easy to review and maintain.
Here is the result showing an example request where I selected option 2:
Regards,
Robert