Flow designer script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
I am trying to create a flow in flow designer where based on the users region, a particular assignment group has to be auto populated. Below is the script I have written in the assignment group toggle script field.
var userId = fd_data._1__get_catalog_variables.requested_for.toString();
var usr = new GlideRecord('sys_user');
if (usr.get(userId)) {
var loc = usr.getValue('u_region');
if (loc == 'sysid') {
return 'assignment group 1 sysid';
}
else if (loc == 'sysid') {
return 'assignment group 2 sys id';
}
else if (loc == 'sysid') {
return 'assignment group 3 sysid';
}
else {
return 'assignment group 4 sys id';
}
}
However I am getting empty value in the assignment group field. Can someone please help me.
- Labels:
-
Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @Bharathkumar33 ,
When you mention sysid in each of your if conditions, those should actually be the sys_ids of the region records you’re checking against. Each if block must compare against the correct region sys_id, not the same placeholder string. Please update your script so that each condition uses the actual region sys_id values.
If you’re still facing issues after that, paste the exact script you’re currently using (with the real sys_ids included) so I can review it and advise the next steps.
if (loc == ' Apac_sysid') {
return 'assignment group 1 sysid';
}
else if (loc == 'EMEA_sysid') {
return 'assignment group 2 sys id';
}
else if (loc == 'AMER_sysid') {
return 'assignment group 3 sysid';
}
else {
return 'assignment group';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Ahoy @Bharathkumar33,
have you tried to log what you get or see the test flow executions?
Also, there's "flow variable" that can be created and its result can be used as a data pill if I remember correctly.
or you can try different approach in, try to add logs to see what is returned from this
var userId = fd_data._1__get_catalog_variables.requested_for.toString();and eventually try to adjust this, to. something else, for example:
var userId = fd_data._1__get_catalog_variables.requested_for;
//or
var userId = fd_data._1__get_catalog_variables.requested_for.sys_id;
Also, is there any chance that the requested_for would be empty?
If you do some changes in flow, you can press the Test button to reuse existing record, no need to create new and new test submissions.
Let me know what you found
Answers generated by GlideFather. Check for accuracy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6m ago
Hi @Bharathkumar33 ,
Try this one,
