- 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:10 PM
Hello @Santhosh15 ,
Instead of g_form.getReference() please try g_form.getDisplayValue().
Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:14 PM
@Nayan Dhamane , We cannot see getDisplayValue in client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:18 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 11:12 PM
@Ravi Chandra_K , Could you please provide full script?