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

Hi Sai,

Please check if any ACL blocking you to delete that specific record on that table. May be that is the cause. Are you able to delete it with same access from List Layout?

Thank you
Prasad

Pranesh072
Mega Sage
Mega Sage

 "Inheriting workflow flag value 'false' for deletion of record '6cfece73db7a4cd05b74f9b2f3961936' from sub-class 'cmdb_ci_win_server'"

 

This message is generated because you are querying the cmdb_ci_server and try to delete the child record present on cmdb_ci_win_server. You can ignore this message.

 

There is some other issue due to which record failed to delete. Can you try it without using the setWorkflow ?

 

var gr = new GlideRecord("cmdb_ci_server");
gr.addEncodedQuery('name=azeunwnsp004^ORu_computer_name=azeunwnsp004^ORasset_tag=azeunwnsp004')
gr.query();
gs.print(gr.getRowCount());
while(gr.next()){
//gr.setWorkflow(false);
gr.deleteRecord();
}

Sai89
Mega Expert

Hi Pranesh,

 

As suggested, i had commented setWorkflow but still it is not deleting the record.

Inheriting workflow flag value 'true' for deletion of record '6cfece73db7a4cd05b74f9b2f3961936' from sub-class 'cmdb_ci_win_server'

Now getting this message after running the background script.

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.

 

Thanks,

Can you share a screenshot?

 

are you getting something from gs.print?

gs.print(gr.getRowCount());

cp11
ServiceNow Employee
ServiceNow Employee

It could be that the parent table still has that record and if you try to open that record it will show up as "Record not found" so instead of deleteRecord, try deleteMultiple, make sure your query is correct otherwise it will delete all the records

Test this in a lower environment, and always be cautious when deleting and test this thoroughly, as deletion is a dangerous operation always.