Unlocking a Hidden Feature: Deleting ServiceNow Records with XML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 02:11 AM
In the realm of ServiceNow data administration, we often encounter the need to transfer data between instances. This process typically involves the use of XML files. One day I was in the midst of my usual manual tasks, moving data between instances using XML. Out of curiosity, I decided to open up one of the XML files to see its contents. That's when I stumbled upon something intriguing: <cmdb_hardware_product_model action="INSERT_OR_UPDATE">
I couldn't help but wonder, what if I changed the action from "INSERT_OR_UPDATE" to "DELETE"? Would it actually delete the imported records? To my surprise, it did!
I searched for articles on this topic but couldn't find any, so I thought it would be interesting to share my discovery. Below are some screenshots of my experiment attempting to delete records using XML.
Let's start by exporting XML records from the sys_user table where the User ID begins with "test".
Once exported, open the XML file and change the action from "INSERT_OR_UPDATE" to "DELETE".
After editing, import the modified records back and observe the results.
You'll notice that the two records we exported are now gone 😄
I also attempted to modify the XML records below by only leaving the sys_ids, and it resulted in the deletion of records from the sys_user table as well.
What are your thoughts on this? Is it a bug or a feature? 🤔
- 848 Views