How to add columns to existing OOB table via script? Also, can we create references via script? How about new table via script?

TT3
Kilo Guru

We need to create several tables, references and add columns in various existing tables. We have multiple environments and would like to know how can we create a single script which we can run on all the environments to have same changes?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

This are the params taken:

table name

display field name

internal field name

type

lenght

referenced table (or keep it empty"

default value

scope

View solution in original post

7 REPLIES 7

Ohh... I mean any documentation in service now to explore this? I tried googling SncTableEditor.createElement but it does not gave any result. I need to know What are the arguments here for createElement? etc.

Community Alums
Not applicable

This are the params taken:

table name

display field name

internal field name

type

lenght

referenced table (or keep it empty"

default value

scope

Hey @Joro Klifov ,

Your article helped me with my requirement. Just 1 thing I'm stuck at, It doesn't work with choice column type. 

Could you let me know how can I use this method for creating choice type of field & how to create choices for that choice field?

I'm using script include because I'm running this for custom app. Script include created in global scope and calling it in custom scope.

 

Thanks,

Utpal Dutta