- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 08:24 PM
Hi @Ankur Bawiskar,
I have requirement where in when user's raise a request and a task will created for that request. (Task is created via flow designer) I need to populate assignment group of tasks based on drop-down variable 'city' in the catalog item. Based on the selection of the city, I need to map the Assignment group of the SC task. .
For eg : If city is selected as banglore it should assign to wp-banglore, if mumbai is selected, it should assign to wp-mumbai and if delhi is selected the sc task assignment group should be wp-delhi.
Thanks
Charutha
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 10:14 PM
while creating the task you can use the f(x) inline script and set the group field
just besides the group field you will see option to write script
Something like this
var city = fd_data.trigger.request_item.variables.city;
if(city == 'bangalore')
return 'groupSysId1'; // group SysId
else if(city == 'mumbai')
return 'groupSysId2'; // group sysId
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
06-25-2023 10:14 PM
while creating the task you can use the f(x) inline script and set the group field
just besides the group field you will see option to write script
Something like this
var city = fd_data.trigger.request_item.variables.city;
if(city == 'bangalore')
return 'groupSysId1'; // group SysId
else if(city == 'mumbai')
return 'groupSysId2'; // group sysId
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
09-02-2024 06:26 PM
Hi @Ankur Bawiskar ,
If I have multiple records for location then what is your suggestion? There are more than 100 locations so it would be not possible for me to write all locations here.
Thanks,
Harsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 12:06 AM
HI @Charutha R1 ,
I trust you are doing great.
- Create a new Catalog Item or modify the existing one to include a dropdown variable named 'city'. This variable will allow users to select the desired city.
- Define Assignment Groups in ServiceNow for each city you want to map. For example, create 'wp-banglore', 'wp-mumbai', and 'wp-delhi' Assignment Groups.
- Navigate to the Flow Designer in ServiceNow to create a new flow or modify the existing one for the task creation process.
- In the flow, locate the point where the task is being created after the request is submitted.
- Add a Script Action or a Function Action to include the logic for assigning the task to the appropriate Assignment Group based on the selected city.
- Write the following code inside the Script Action or Function Action to determine the Assignment Group dynamically based on the selected city:
var city = current.variables.city; // Fetch the selected city from the request
var assignmentGroup = '';
switch (city) {
case 'banglore':
assignmentGroup = 'wp-banglore';
break;
case 'mumbai':
assignmentGroup = 'wp-mumbai';
break;
case 'delhi':
assignmentGroup = 'wp-delhi';
break;
// Add more cases for other cities if necessary
default:
assignmentGroup = ''; // Handle the case when no city is selected or an invalid city is chosen
}
current.assignment_group = assignmentGroup; // Assign the determined Assignment Group to the task
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi