- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 02:06 AM
Hi Team,
I have a requirement that Based on Requester's last name starting Alphabet i Need to assign the catalog task to Specific Assignment Group (they have given 3 Assigment Groups)
Condition :
(if lastname (A-I or N) ASSIGMENT GROUP 1)
(if lastname (J-Q or R ASSIGNMENT GROUP 2)
(if lastname (S-Z ASSIGNMENT GROUP 3)
This script is wirking fine in Workflow but its not working in Flow designer
In Flow designer it's showing undefined input 'assignment_group' error
How can i implement this below script in Flow designer.
var lastname=current.request.requested_for.last_name;
var split_lastname=lastname.substr(0,1);
if(split_lastname.toLowerCase()=='a'||'b'||'c'||'d'||'e'||'f'||'g'||'h'||'i'||'n')
{
task.assignment_group='802cb4b3db069850e783f3671d961969';//Assignment grp 1
}
else if(split_lastname.toLowerCase()=='j'||'k'||'l'||'m'||'o'||'p'||'q'||'r')
{
task.assignment_group='b14c7877db069850e783f3671d9619f0';//Assignment grp 2
}
else if(split_lastname.toLowerCase()=='s'||'t'||'u'||'v'||'w'||'x'||'y'||'z')
{
task.assignment_group='875cf4f3db069850e783f3671d96193c';//Assignment Group 3
}
Thanks in Advance
Balaraju
Solved! Go to Solution.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 03:03 AM
HI,
Couple of improvements to script.
For example:
var lastname=current.request.requested_for.last_name; Replace it with
var lastname=fd_data.trigger.current.request.requested_for.last_name;
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 02:25 AM
Hi,
Show me where you wrote this script on flow designer.
Thakns,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 02:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 03:03 AM
HI,
Couple of improvements to script.
For example:
var lastname=current.request.requested_for.last_name; Replace it with
var lastname=fd_data.trigger.current.request.requested_for.last_name;
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 03:05 AM
this should work in the script section
1) you need to select the data pill corresponding to that RITM record
2) Also use return statement to return the group sys_id
3) you need to compare the variable for each value
try updated script below
var lastName = fd_data.trigger.request_item.request.requested_for.last_name;
var split_lastname = lastname.substr(0,1);
split_lastname = split_lastname.toLowerCase();
if(split_lastname == 'a'|| split_lastname == 'b'|| split_lastname == 'c'|| split_lastname == 'd'|| split_lastname == 'e'|| split_lastname == 'f'|| split_lastname == 'g'|| split_lastname == 'h'|| split_lastname == 'i'|| split_lastname == 'n')
{
return '802cb4b3db069850e783f3671d961969';//Assignment grp 1
}
else if(split_lastname == 'j'|| split_lastname == 'k'|| split_lastname == 'l'|| split_lastname == 'm'|| split_lastname == 'o'|| split_lastname == 'p'|| split_lastname == 'q'|| split_lastname == 'r')
{
return 'b14c7877db069850e783f3671d9619f0';//Assignment grp 2
}
else if(split_lastname == 's'|| split_lastname == 't'|| split_lastname == 'u'|| split_lastname == 'v'|| split_lastname == 'w'|| split_lastname == 'x'|| split_lastname == 'y'|| split_lastname == 'z')
{
return '875cf4f3db069850e783f3671d96193c';//Assignment Group 3
}
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader