Show UI Action only on tables with a Script type field

Mark Roethof
Tera Patron
Tera Patron

Hi all,

 

For one of my Instance Scan use cases, I am thinking of creating a UI Action which should only be visible for tables which contain at least one script type field. Ideally ofcourse using the condition field within the UI Action for this. 

 

Ofcourse I could create a UI Action specifically for every single table with a script type field, though then I would need to create hundreds of UI Actions, and what if new tables are added... Instead wanting to run this against sys_metadata, which works fine for my use case. Though now the question, also limiting this to only the tables with an actual script field. 

 

Any ideas?

I haven't done much brainstorming myself yet, though thought let's post on the community, perhaps someone already has did some serious thinking on this 😅

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

1 ACCEPTED SOLUTION

Ah yeah, I solved it by using g_scratchpad. A business rule populating the value, and just using it in the UI Action. It was just for brainstorming / playing around, so not actual production work. For example haven't looked into if this would hurt performance.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

10 REPLIES 10

Meloper
Kilo Sage

Hi Mark,

i dont know if it also Works for Scoped apps.
but this is written in theDocs: Select Global to make the action available on all tables.

Meloper_0-1707373660467.png

Create a UI action (servicenow.com)

An i guess then you can check if a Field Type like this is Part of the Current Table?
Condition <- Script Include

BR

Stefan Reichelt
Tera Guru
Tera Guru

I have exactly the same issue, just for another scenario. I'm working in a scoped application, and the Table field does not allow me to use sys_metadata (nor Global, nor anything below sys_metadata like the UI Action table itself). I don't really want to create another application in Global scope just to get it running. Any ideas?

Update: As it is fine for my scenario (at least for this stage where it's rather a technology demonstration), I decided to go with a Global scoped app which I call "extension" to the actual app. With that approach, I was able to create the UI Actions for sys_metadata.

Stefan Reichelt
Tera Guru
Tera Guru

Apart from my own challenge to add such a UI Action in a scoped application - what if you implement a little workaround for now, and create a Sys Property with a list of all the tables where you want the UI Action to appear?

Then you could still create it on sys_metadata, and restrict the access using getProperty() with a check if current.getTableName() is included there or not.

Maybe not the most elegant option, but it should work.