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

SumanthDosapati
Mega Sage
Mega Sage

@samadam 

What is the filter condition you want to apply? 

In your script it looks like you are checking profile table and set the assignment group which seems to be incorrect.

Can you explain your business requirement.

 

Regards,

Sumanth

Ankur Bawiskar
Tera Patron
Tera Patron

@samadam 

are you configuring the rule for HR task?

Field "u_pay_plan" is of what type? string?

Script looks fine to me

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Arun_Manoj
Mega Sage

Hi @samadam ,

 

Please call the sys_id's through property function.

 

 

thanks

Arun Manoj

Rajesh Chopade1
Mega Sage

hi @samadam 

The issue you're describing—where even a log statement at the beginning of the script isn't executing—suggests the script may not be running at all.

Also you mentioned checking the short description, but it’s not in the provided script.

I would suggest, use gs.info() generously to debug the script and confirm which parts are executing.

Then check that current.parent.subject_person, u_pay_plan, and the assignment group sys_ids are valid.

Ensure the rule’s conditions, order, and table are correctly configured.

 

I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

Rajesh