Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Policy to set Assignment Group is not working

Navaneeth1
Tera Guru

I created a UI Policy for a condition and wrote a script in advance view as the following:

function onCondition() {
g_form.setValue('assignment_group', "SNS - Admin");
}

The group exists, and the form shows the change but when I click save on the form it shows the following error below the assignment group field:
 Match not found, reset to original

The table being used for this UI policy is part of a scoped custom application that inherits from the Incident table. The UI Policy is properly scoped. When I select the assignment group from the list of groups, I can save properly. 

I tried the same by creating a client scrip and the same error is shown.
Can someone please let me know how I can fix this issue?
Thank you in advance!

3 ACCEPTED SOLUTIONS

Anurag Tripathi
Mega Patron
Mega Patron

Can you try the doing the same using sys_id of the group instead of the name.

-Anurag

View solution in original post

Unique45
Mega Sage
Mega Sage

Hello @Navaneeth1,

Assignment group is reference field so, you need to set sys_id of the group instead of group name.

Add sys_id of the group instead of group name.

Please refer below code:

function onCondition() {
g_form.setValue('assignment_group', "sys_id_of _the_group");
} 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Please mark correct/helpful if this helps you!

View solution in original post

Utpal Dutta
Tera Guru
Tera Guru

Hi Navneeth,

Assignment group is a reference field so it accepts sys_id as a value & not display value of the group so please pass sys_id in your set value like below.

 

g_form.setValue('assignment_group', 'SYS_ID of Assignment group');

 

If my answer helps then please mark it correct.

 

Thanks,

Utpal

View solution in original post

6 REPLIES 6

Anurag Tripathi
Mega Patron
Mega Patron

Can you try the doing the same using sys_id of the group instead of the name.

-Anurag

Unique45
Mega Sage
Mega Sage

Hello @Navaneeth1,

Assignment group is reference field so, you need to set sys_id of the group instead of group name.

Add sys_id of the group instead of group name.

Please refer below code:

function onCondition() {
g_form.setValue('assignment_group', "sys_id_of _the_group");
} 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Please mark correct/helpful if this helps you!

Utpal Dutta
Tera Guru
Tera Guru

Hi Navneeth,

Assignment group is a reference field so it accepts sys_id as a value & not display value of the group so please pass sys_id in your set value like below.

 

g_form.setValue('assignment_group', 'SYS_ID of Assignment group');

 

If my answer helps then please mark it correct.

 

Thanks,

Utpal

AndersBGS
Tera Patron
Tera Patron

Hi @Navaneeth1 ,

 

Why client side and not server side? And why nook utilize assignment lookup rules (off course based on the condition on when/what assignment should be made). 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/