Create Custom Table using REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2018 03:51 AM
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.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2018 11:24 AM
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);
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2018 11:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2018 06:24 PM
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