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

Community Alums
Not applicable

Hi TT,

yes we can. This is working example of mine :

SncTableEditor.createElement("x_189996_mail_auto_test_table", "Class", "sys_class_name", "sys_class_name", "80", "", "javascript:current.getTableName();", "global");

P.S. 1 - application, Field name, class name to be used, length, table, in which scope

Cheers,

Joro

Thank you!! need more info though. Where do you run this script and if you can pls give reference to documentation around it. 

 

Community Alums
Not applicable

I dont have any documentation for this . Posted the way to do it for reference column. I use it in background script but any server side javascript can execute it. It should be ran from global scope - if you need custom scope use wrapper with script include which is in global so you can use it.

For table - seen it once but cant remember . I know there is for dropping tables for sure 🙂

Cheers,

Joro

Community Alums
Not applicable

For reference type it should look like this:

SncTableEditor.createElement("fm_expense_line", "My reference3", "my_reference3", "reference", "32", "alm_asset", "alm_asset", "global");