How to set UI Action Condition? Where I will use Current and Where I will gs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 11:07 AM
I have Confused about the role of the "current" object in UI Action conditions. When and why would you typically use "current" to evaluate a condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 11:10 AM - edited ‎10-05-2023 11:11 AM
current, looks at the current record. it has access to the current record.
the conditions is when the UI actions displays in the menu or wherever you have it set.
like
current.active == true
so if the record is active it will show.
or current.state == 'closed'
if the current stat is closed, then the UI action will be displayed. so this could be a "reopen" button that you only want to show when the task is closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 11:11 AM
Hello,
current is used when you want to refer to any field on that particular table. So if the Ui action is on incident and you want to put a condition on assigned to field you will use current.assigned_to. So it will be used to get any field on the table on whuch Ui action ahs been created
The GlideSystem (referred to by the variable name 'gs' in any server-side JavaScript) API provides a number of convenient methods to get information about the system, the current logged in user, etc.
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 11:11 AM
Hi @amazs123 ,
"current" is only available at server-side.
For client-side access to the current record, use g_form.
Refer to existing OOTB UI actions where current is used for better understanding.
Regards,
Badal Khojare
Community Rising Star 2023