script within assignment rule

patricklatella
Mega Sage

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);

}

1 ACCEPTED SOLUTION

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.

View solution in original post

15 REPLIES 15

SanjivMeher
Kilo Patron
Kilo Patron

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.

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.


Gowrisankar Sat
Tera Guru

Hi Patrick,



Can you put a log/addinfomessage for "current.variables.user.location.u_region" to check the value of user location?


harishdasari
Tera Guru

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