- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:11 AM
I attempted to extend Task on an existing custom table, as seen here - https://community.servicenow.com/message/727348#727348
The table successfully generated a new temp table z_x_inst_app_tablename, but due to a naming conflict on one of the fields, it failed to merge z_x_inst_app_tablename back into
x_inst_app_tablename. I fixed the naming conflict, but now I have a temp table that I cannot seem to get rid of. How do I delete it?
The temp table extends Task, so Deleting All Records from the System Definitions -> Tables fails due to the global scope of Task.
I cannot re-parent the temp table to remove Task, b/c it is not in customer scope (z_ prefix instead of x_)
I cannot re-parent the original, b/c the temp table already exists and is not replicating.
I also tried deleting the Dictionary entry of the temp table, which simply renamed the table label to Task and left it in place.
Any help would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 12:21 PM
Hi rako
One way to achieve this is using the TableUtils Server Side Legacy API Methods. https://developer.servicenow.com/app.do#!/api_doc?v=istanbul&id=c_TableUtilsAPI
"Please be extremely cautious when droping a table and its references". (I hope you previously have saved your work in update sets, and get a backup from all data and related work on the table.)
If you are complete sure the table must be gone, let's proceed.
1) From the Legacy API chose the method which best works for you. Check consciously to make the best choice for your needs. For Example: dropAndClean
2) Identify the entries related to your table on the System Dictionary. (System Definition -> Dictionary). Filter by your table name. [Verification step]
3) Go to System Definition ->Scripts - Background (Be extremely cautious at running script from here, adhere to Servicenow recommendations Scripts - Background)
And create a function to run the chosen method from TableUtils Legacy API, for example:
testDropTables();
function testDropTables(){
var table = new global.TableUtils("z_x_yourCompanyCode_yourApp_temp_table");//To get proper output with tableExist method
table.dropAndClean("z_x_yourCompanyCode_yourApp_temp_table");
gs.print("+++ Does 'my_table' exist? " + table.tableExists());
gs.print("+++ Script Test Finished...");
}
4) Once the script is in place, please chose proper scope to run the script, in this case global as TableUtils belong to that scope.
With all set just run the script, you will get a log output similar to:
TABLE DROP: ed morales dropped table z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing gauges for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing forms for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing styles for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing forms sections for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing lists for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing related lists for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing references to z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing dictionary entries for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing table-specific ACL entries for z_x_yourCompanyCode_yourApp_temp_table
Background message, type:info, message: Table deleted
*** Script: +++ Does 'my_table' exist? false
*** Script: +++ Script Test Finished...
Finally refresh the filter created on step 2), you will notice the records related to the table have been cleared.
I hope this helps
Eduardo Morales S.
Servicenow Developer and Consultant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:43 AM
Hi Harsh,
Thank you for the response. I am not sure that I understand. 1) I need the original table to extend Task. 2) I need to remove the temp table from the system. The temp table is not in the application scope, it is in a temp scope that I cannot modify (z_).
Deleting and renaming the table would accomplish #1, but I am not sure how to go about #2. Is there something that I am missing?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:45 AM
if you have created your table in different scope for eg:
let's take an example your application scope is test and you created a table there.
now if you want to delete it then you must be in that scope.
may i see your main homepage screen?
there is an option to change the application or select an application.
Thanks,
Harshvardhan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 10:53 AM
Let me know if that answered your question. If so, please mark it as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this discussion from your "inbox", use the "mark as correct" option under actions. If you are viewing it directly from the thread use the Correct Answer link (red with a star).
Thanks,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 12:21 PM
Hi rako
One way to achieve this is using the TableUtils Server Side Legacy API Methods. https://developer.servicenow.com/app.do#!/api_doc?v=istanbul&id=c_TableUtilsAPI
"Please be extremely cautious when droping a table and its references". (I hope you previously have saved your work in update sets, and get a backup from all data and related work on the table.)
If you are complete sure the table must be gone, let's proceed.
1) From the Legacy API chose the method which best works for you. Check consciously to make the best choice for your needs. For Example: dropAndClean
2) Identify the entries related to your table on the System Dictionary. (System Definition -> Dictionary). Filter by your table name. [Verification step]
3) Go to System Definition ->Scripts - Background (Be extremely cautious at running script from here, adhere to Servicenow recommendations Scripts - Background)
And create a function to run the chosen method from TableUtils Legacy API, for example:
testDropTables();
function testDropTables(){
var table = new global.TableUtils("z_x_yourCompanyCode_yourApp_temp_table");//To get proper output with tableExist method
table.dropAndClean("z_x_yourCompanyCode_yourApp_temp_table");
gs.print("+++ Does 'my_table' exist? " + table.tableExists());
gs.print("+++ Script Test Finished...");
}
4) Once the script is in place, please chose proper scope to run the script, in this case global as TableUtils belong to that scope.
With all set just run the script, you will get a log output similar to:
TABLE DROP: ed morales dropped table z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing gauges for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing forms for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing styles for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing forms sections for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing lists for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing related lists for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing references to z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing dictionary entries for z_x_yourCompanyCode_yourApp_temp_table
*** Script: removing table-specific ACL entries for z_x_yourCompanyCode_yourApp_temp_table
Background message, type:info, message: Table deleted
*** Script: +++ Does 'my_table' exist? false
*** Script: +++ Script Test Finished...
Finally refresh the filter created on step 2), you will notice the records related to the table have been cleared.
I hope this helps
Eduardo Morales S.
Servicenow Developer and Consultant