- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 08:13 AM
Hi Guys,
I am struggling with this one.
I have two fields on the form:
-Difficulty
-New Ticket
What I need to do is to make the New Ticket field hidden on the form unless the difficulty field is Level 2
Any advice?
Regards
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 08:22 AM
I would recommend using UI policy option here.
When possible, consider using a UI policy instead of a client script for these reasons:
- UI policies have an Order field to allow full control over the order in which client-side operations take place.
- UI policies do not require scripting to make a field mandatory, read-only, or visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 08:23 AM
Hi Matt,
The Best way is to Use UI Policy as Pradeep mentioned above. It is always recommended to use UI Policy over Client Script wherever possible.
In case you are looking for Client script, then you need to write an onChange Client Script on change of the field Difficulty. The sample code is given below. Please take care about the appropriate field name in the script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
g_form.setDisplay('u_new_ticket', false);
return;
}
if (isLoading && g_form.getValue('u_difficulty') == '2'){
g_form.setDisplay('u_new_ticket', true);
}
else if (newValue == '2'){
g_form.setDisplay('u_new_ticket', true);
}
else{
g_form.setDisplay('u_new_ticket', false);
}
}
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2020 05:17 AM
Yes, it worked. Thank Amlan!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 08:24 AM
Hi, you need to use a ui policy with the condition difficulty is not level 2
with ui policy action New ticket visible=false.
this is best practice for this cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 09:06 AM
I can concur with the other replies that the UI policy is the easiest and best way to go since the system already had that functionality available to you. It should be a pretty easy UI policy to create for your need.