- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:07 PM
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.
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 01:08 AM
@Samaksh Wani , From onchange client script is not working so i done through ui policy.
it is working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:42 PM - edited 08-01-2023 10:43 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:13 PM
@Samaksh Wani , This code will works for only particular assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:24 PM - edited 08-01-2023 11:32 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:36 PM
This is not working, see below screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:56 PM
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