- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-17-2022 04:13 AM
I had a very simple requirement: toggle (hide/show) a form field via an UI Action button. This is achievable - if you first check if the field is visible or not - and then set its visibility (hide it or show it).
I've seen some Community answers on this topic - eg., can't be done, use UI Policy, etc., The one that really works is listed here
To summarize: if you really need to get this done via n UI Action - the code that works is:
(g_form.isVisible(g_form.getGlideUIElement("FIELD_NAME"), g_form.getControl("FIELD_NAME")))
Now, coming to my use-case:
function onCondition(){
if(g_form.isVisible(g_form.getGlideUIElement("script"), g_form.getControl("script"))){ // Check if the field named "script" is current visible
g_form.setDisplay('script',false); // It's visible, so - hide it.
}
else{
// The "script" field is currently NOT visible, so show it
g_form.setDisplay('script',true);
}
}
That's it! It's pretty basic - but I hope it helps someone.
- 6,367 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks Vin! Really saved my life with this one - I saw other threads saying this wasn't possible so I'm really glad I stumbled onto this. Works great in my implementation. Kudos!
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
If a field "Field1 " has to be shown in a customer order record, only when a fallout order record's state turns to "open".The customer order and fallout order are linked through customer order number. solution please?