unable to delete record through background script also getting this message "Inheriting workflow flag value 'false' for deletion of record '6cfece73db7a4cd05b74f9b2f3961936' from sub-class 'cmdb_ci_win_server'"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 05:35 AM
Hi,
I could not able to delete one server record through background script
getting this message after running it. Please help me out on this how can i do this.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 05:50 AM
Can you share your script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 05:59 AM
Hi Pranesh,
Please find below
var gr = new GlideRecord("cmdb_ci_server");
gr.addEncodedQuery('name=azeunwnsp004^ORu_computer_name=azeunwnsp004^ORasset_tag=azeunwnsp004')
gr.query();
var deleteCount = 0;
while(gr.next()){
gr.setWorkflow(false);
gr.deleteRecord();
deleteCount++;
}
gs.print('Records Deleted: '+ deleteCount);
thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 06:22 AM
Hi,
So its giving count but not deleting record?
Please add semicolon anyways at last of encoded query 🙂
var gr = new GlideRecord("cmdb_ci_server");
gr.addEncodedQuery('name=azeunwnsp004^ORu_computer_name=azeunwnsp004^ORasset_tag=azeunwnsp004');
gr.query();
var deleteCount = 0;
while(gr.next()){
gr.setWorkflow(false);
gr.deleteRecord();
deleteCount++;
}
gs.print('Records Deleted: '+deleteCount);
Thank you
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2021 08:03 AM
Hi Prasad,
Did it with semicolon as well, but not working.
Basically my issue is, when you click on "i" icon from list view the record is not found that means record deleted.
But in list view it is still showing with the details and it is impacting billing.
any suggestions.
thanks.