- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:12 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 09:41 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:22 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:45 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 11:05 AM
Its custom table , one of my colleague created by mistake and want to delete .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 01:41 PM