Setting assignment group on hr task thru assignment rule

samadam
Kilo Sage

var grade = new GlideRecord('sn_hr_core_profile');
grade.addQuery('user', current.parent.subject_person);
grade.query();
while (grade.next()){
var answer = grade.u_pay_plan.getDisplayValue();
if (answer == 'AG'){
current.assignment_group= '123490401ba94a104ebb2171f54bcbb7';}
else {
current.assignment_group = '123438f81b39c690da5ddb1de54bcb27';
}
}

I am trying this in the script part with checking short description matching. This is not working. I have log statement in the beginning even that doesnt come thru. Any idea? 

5 REPLIES 5

OlaN
Giga Sage
Giga Sage

Hi,

In your script you are doing a query on the sn_hr_core_profile table.

But you are using the reference to the current.parent.subject_person attribute.

This field is a reference to the sys_user table.

So either you'll need to change the table you are looking at, or change the field on which you are performing the query on.
The field on HR case that contains the hr_profile would read current.parent.hr_profile

 

Also, don't put hard-coded sysIDs in your script, that's just bad practice.