- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 11:58 AM
Hi all,
seeing some odd behavior from my script within an assignment rule. What I need is, if the current user's region is "NA" then it executes that part of the script, and if it's not "NA", then for it to call the script include at the bottom of the script.
Having trouble getting it to work...anyone see what's wrong? I've got it returning the region correctly, but the assignment group is not getting assigned properly...even if the region='NA'.
thanks!
var region = current.variables.user.location.u_region;//looks up current user's location
if(region == 'NA'){
current.assignment_group = 'UC Services';
return;
}else{
var AssignmentScripts = new u_CubicAssignmentScripts();
current.assignment_group = AssignmentScripts.GetNewHireGroup(region);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 12:16 PM
The script should have been
var region = current.variables.user.location.u_region;//looks up current user's location
if(region == 'NA'){
current.assignment_group.setDisplayValue('UC Services');
}else{
var AssignmentScripts = new u_CubicAssignmentScripts();
current.assignment_group = AssignmentScripts.GetNewHireGroup(region);
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 12:02 PM
I think you need to change the first line to
var region = current.variables.user.location.u_region.u_name;//looks up current user's location
If region points to a table
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 12:04 PM
Hi Sanjiv,
"user" is the variable I'm using to get the region...and I'm just trying to dot walk the user's info, and if I put in a gs.info('region is '+region) it shows properly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 12:05 PM
Hi Patrick,
Can you put a log/addinfomessage for "current.variables.user.location.u_region" to check the value of user location?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 12:05 PM
Hi Patrick,
In your code instead of giving like this did you try giving sys_id of the assignment group ?
please give the sys_id of this assignment group and check
current.assignment_group = 'UC Services';
Thank you