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

Update: Implemented and tested - it works for me. I put a list of tables to enable for these UI Actions into a sys_property, and used them in the Condition field like this:

 

(gs.getProperty('<my_property>').includes(current.getTableName()))

 

is the Value of the Property a String (comma List of Table names) or an array

ankitbanerj
Tera Expert

Hi @Mark Roethof , have you found any solution to this?

 

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

Ohh, I have not used g_scratchpad for this. Just have a look at my solution:

(typeof current.script != 'undefined' && !gs.nil(current.script))

used this in the condition field.