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

Utpal Dutta
Tera Guru

Hi there,

I suggest you use Assignment rules rather than creating a new client script for this. Please take a look at this article to get more details about Assignment rules.

 

If my answer helps, then please mark it correct.

 

Thanks,

Utpal

If you still want to use client script then you need to compare the value to either null or bank for category field to clear the value. 

Replace your first IF statement with below:

if (newValue == '' || newValue == null) {
        g_form.clearValue('assignment_group');
    }

 

Thanks

HI @Utpal Dutta . Your scripting solution didn't work. Thanks for the response though.

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