Setting assignment group on hr task thru assignment rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 01:23 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 11:28 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 11:38 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2025 11:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 12:03 AM
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