Create Custom Table using REST API

Godi
Kilo Explorer

I am new to ServiceNow platform. I am exploring the ways to create/extend tables using ServiceNOW RESTAPI. I am unable to find the API and methods to create a custom table and create custom fields. Any help in this regard is appreciable. 

Thank You.

3 REPLIES 3

Nitesh Balusu
Giga Guru

The script include would look something like this. You can make changes and invoke this code from where you need it to be invoked from.

 

(/*String*/ tableLabel, /*String*/ tableName, /*String?*/ parentTableName, nonSystemExports) {


   // Update mode - ensure the table does not already exist


   if (this.tableExists(tableName))


   return;


   var creator = new TableDescriptor(tableName, tableLabel);


   if (parentTableName && !parentTableName.nil()) {


   creator.setExtends(parentTableName);


   }


   creator.create();



   if (parentTableName == 'sf_sm_flow')


   this.addUpdateSynch(tableName, parentTableName);



   if (nonSystemExports != undefined)


   this._exportTable(tableName, nonSystemExports);


   },

Prateek kumar
Mega Sage

This thread will give you some lead.

https://community.servicenow.com/community?id=community_question&sys_id=70bff26ddb58dbc01dcaf3231f961957


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Godi
Kilo Explorer

Thanks Nitesh and Prateek for your quick reply. By going through the them, it looks like there are no direct methods (post/put) in REST API or webservice that can be used to create/extend a custom table! 

In the below specified article, its mentioned that using Post method of REST API , table can be created!  I could not find the parameters used in Table API!

https://community.servicenow.com/community?id=community_question&sys_id=ffce0f61dbdcdbc01dcaf3231f961910