On incident form, populate the assignment group automatically when category is selected.

pk16514
Tera Contributor

On incident form, populate the assignment group automatically when category is selected.
How to clearValue of assignment group field when category is None. using client script.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (newValue === '') {
        g_form.clearValue('assignment_group');
    }

    g_form.setValue('assignment_group', '019ad92ec7230010393d265c95c260dd');
}

What changes I need to make so that assignment group field value is clear when selected category is none in incident table

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi @pk16514 Create a onchange client script on field "Category" and add the below script as per screenshot

if (newValue === '') {
    g_form.setValue('assignment_group','');// clear group value when category is none
      return;
   }

HarishKM_0-1704347088945.png

 

Regards
Harish

View solution in original post

8 REPLIES 8

Thanks @Harish KM but it did not work.

pk16514
Tera Contributor

Hi @Harish KM ...sorry I forgot to put return...it's working now. Thanks a lot.

Sagar Pagar
Tera Patron

Hi @pk16514,

 

I would suggests to use the Assignment rules with conditions instead of writing client scripts for the same.

 

If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @pk16514 

 

NOt sure why you write the code, this can be done via Looks up /.assignment rules very easily. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************