The CreatorCon Call for Content is officially open! Get started here.

How to hide the incident fields based on assignment group contain "network" ?

Santhosh15
Tera Guru

Hello Experts,

 

I have one requirement, which is used to hide the two fields based on client script.

I have the onchange client script but it is not working, could you please help on this.

Santhosh15_0-1690952815847.png

var group = g_form.getReference('assignment_group').indexOf("network") > -1;
if (group == true) {
g_form.setVisible('u_vendor_name', false);
g_form.setVisible('u_vendor_ticket', false);
} else {
g_form.setVisible('u_vendor_name', true);
g_form.setVisible('u_vendor_ticket', true);
}

 

Thanks

@Ankur Bawiskar @Palani Kumar @Ravi Chandra_K @Samaksh Wani 

1 ACCEPTED SOLUTION

@Samaksh Wani , From onchange client script is not working so i done through ui policy.

it is working.

View solution in original post

19 REPLIES 19

Nayan  Dhamane
Kilo Sage

Hello @Santhosh15 ,

 

Instead of g_form.getReference() please try g_form.getDisplayValue().

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

@Nayan Dhamane , We cannot see getDisplayValue in client script.

Ravi Chandra_K
Kilo Patron
Kilo Patron

since you are writing on change on assignment group, 

You can try using newValue.toString().indexOf('network') > -1

or newValue.indexOf('network') > -1

 

Please hit the thumb and Mark as correct if it helped!

Kind Regards,

Ravi Chandra

@Ravi Chandra_K , Could you please provide full script?