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'"

Sai89
Mega Expert

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.

17 REPLIES 17

Pranesh072
Mega Sage
Mega Sage

Can you share your script?

Sai89
Mega Expert

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.

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

Sai89
Mega Expert

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.