unable to delete csm custom tables , restricting business rule unable to deactivate

Not applicable

Hi All,

I was trying to delete csm custom tables getting below error and i unable to active false that BR. kindly suggesst

var gr = new GlideRecord('sys_db_object');
gr.addQuery('sys_id','0a9b23c5db48ec90765427360596196d');
gr.query();

if(gr.next()) {

gr.deleteRecord();
}


Validate Table Delete - BR

Operation against file 'sys_db_object' was aborted by Business Rule 'Validate Table Delete^0a9b23c5db48ec90765427360596196d'. Business Rule Stack:Validate Table Delete
Background message, type:error, message: Insufficient rights to delete table sn_customerservice_stakeholders. User does not have delete access.

 kindly help me to delete this

 

 

 

1 ACCEPTED SOLUTION

Hi,

if that custom table is created in Customer Service Management i.e. CSM scope as I could see with the prefix.

Then you cannot delete custom table created within an installed Scoped System Application.

There is known issue for this.

KB Article: KB0623901

Solution: You can use below script and run in scripts background in global scope. Ensure you put your table name

var tableDeletion = new TableUtils();
tableDeletion.dropAndClean('sn_customerservice_stakeholders');

Note: Running this script will permanently delete table and all its data.

Do check my blog as well related to this

Delete Custom table created in installed Scoped System Application

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Willem
Giga Sage
Giga Sage

The account you are logged in with while running the Script does not have sufficient rights.

 

Try with an admin account or see if there is a Delete ACL that is preventing you from Delete access.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you explain what is the business need to delete table from script?

ACLs won't be evaluated when you use GlideRecord.

So please check that business rule which might be restricting -> Validate Table Delete

You cannot delete tables which comes with Store applications.

This table "sn_customerservice_stakeholders" seems OOB table from CSM scope so you possibly cannot delete it.

If you still want to try then do this

var gr = new GlideRecord('sys_db_object');
gr.addQuery('sys_id','0a9b23c5db48ec90765427360596196d');
gr.query();

if(gr.next()) {

gr.setWorkflow(false); // to avoid triggering any BR

gr.deleteRecord();
}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Not applicable

Its custom table , one of my colleague created by mistake and want to delete .

To delete a table OOTB you need to be Admin. Do you have the admin role?

 

Also have you tried using the User Interface? Navigate to:

  • System Definitions --> Tables
  • Search for your table
  • Delete

find_real_file.png