How to set UI Action Condition? Where I will use Current and Where I will gs?

amazs123
Kilo Contributor

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?

3 REPLIES 3

Steven Young
Tera Guru

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.

Saurav11
Kilo Patron
Kilo Patron

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.

 

https://docs.servicenow.com/en-US/bundle/vancouver-api-reference/page/app-store/dev_portal/API_refer...

 

Please mark my answer as correct based on Impact.

Badal Khojare
Mega Sage
Mega Sage

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.

Ref: https://docs.servicenow.com/bundle/london-platform-administration/page/administer/list-administratio...

 

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023