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

Just wanted to inform and challenge your question a bit. Though If you investigated, fine ofcourse.

You could add the scripting into a Global Script Include, and just calling that script include from the scoped app. Should work fine, with this you could still use whatever is not working scoped. Scoped limitations don't have to be limitations 🙂

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

GlideTableCreator is not an editable script include, and is only available in Global.

Also this call is failing new Packages.java.util.HashMap() for the same reason.

No I mean you would use GlideTableCreator in a fix script, background script, whatever: in your case, this can't be done because it doesn't work in a scoped application.
So instead of that, create a global Script Include with your scripting, using the GlideTableCreator etc.. Then just call that new Script Include through fix script, background script, whatever.

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 do not want the extended table in Global, I want it in the application scope.  GlideTableCreator can only be called from Global.  I don't want that.

Yes I understand. I will just make an example, that would probably help.

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