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

please try checking gs.log instead of gs.info



and also I think dot walk will support only upto 4 steps. so that could be the problem.


patricklatella
Mega Sage

I think I have it working...just need to change my function in the script include


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.

patricklatella
Mega Sage

Hi Sanjiv,


I think that's close, it's calling the script include if the region is not "NA", but it's not passing the region to the script include properly...it's passing "NA" even if region is not 'NA'


patricklatella
Mega Sage

I got it...had to correct the script include one more time.   Here's my final script:   thanks everyone!



var region;


region = current.variables.user.location.u_region;


if(region == 'NA'){


current.assignment_group = '0eae18fb4f638e004100029d0210c77b';


}else{


var region;


region = current.variables.user.location.u_region;


var AssignmentScripts = new u_CubicAssignmentScripts();


current.assignment_group = AssignmentScripts.GetDesktopSupportGroup2(region);


}