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

Samaksh Wani
Giga Sage

Hello @Santhosh15 

 

Try this script :-

 

 

 

var group = g_form.getValue('assignment_group');
if (group == 'sys_id_of_network') {
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);
}

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

@Samaksh Wani , This code will works for only particular assignment group.

Hello @Santhosh15 

 

In that case try this :-

 

 

 

 

var group = g_form.getReference('assignment_group', callbackF);
function callbackF(group){
if (group.name.indexOf('network')>-1){
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);
}
}

 

 

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

This is not working, see below screenshot

Santhosh15_1-1690958164547.png

 

 

anonymous13
Tera Expert

Hello @Santhosh15 

You can write client script for this :
Client script:

Table : Incident
Type: onChange
Field_name : Assignment group

Script: 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if ((g_form.getValue('assignment_group')) != 'sys_id') // sys id of 'network' -- assignment group
{
g_form.setVisible(''u_vendor_name', true);
g_form.setVisible(''u_vendor_ticket'', true);
} else {

g_form.setVisible(''u_vendor_name', false);
g_form.setVisible(''u_vendor_ticket'', false);
}

}

Please mark helpful 

anonymous13_0-1690959314169.png