Create table using a script in a scoped application

KJM1
Kilo Explorer

I have a bunch of custom columns added to the sn_si_incident table.  I would like to remove them from sn_si_incident and place them in a table that extends sn_si_incident (leaving the base table as OOB).

Instead of manually creating each field, there are a lot of them.  I would like to create a script to create the extended table and add the custom fields.  Saving me a lot of time and possible typing mistakes.

Every article i see uses Packages.java.util.HashMap() and new GlideTableCreator(table_name , table_name).  Neither can be used in a scoped application.  Is there a way to do this in a scoped application?

Any assistance would be greatly appreciated.

1 ACCEPTED SOLUTION

See below, tested = works.

1) create Script Include in global
2) create Fix Script in your scoped app + execute Fix Script
3) see table created (in my example in HR Core scope)

find_real_file.png

find_real_file.png

find_real_file.png

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

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

12 REPLIES 12

Mark Roethof
Tera Patron
Tera Patron

Hi there,

What do you mean with "a lot of them", how many custom fields are we talking about? If it's 20 custom fields, how much time did you already spend, would it really save you time? If it's far more: do be aware of the Subscription model which could get you into trouble. Also if it's far more, might your data model just be a bit messy?

If it's just for expanding your own knowledge, oke nice challenge 🙂 Though if it's just to automate a one time table creation, I would think twice on wasting time on this.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

There are 70+ custom fields, I took this project over so I did not create them.  I don't think it is best practice to add 70+ custom fields to an OOB table so I want to extend the table.

Oke but be aware: this will have impact on the Subscription model. So rethink if this is even a way to go. Maybe check first with your ServiceNow account manager about the financial consequences of this?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

I have already discussed with SN rep.  Do you know if this can be done in a scoped application?