Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to delete stockroom

Jerry Ong
Tera Contributor

Hi All,

 

I am not able to remove a stockroom that was decommissioned recently. The reason being the stockroom entry was locked due to reference made in the previous disposal orders that I had created.

 

Is there a way to workaround this? The disposal orders were closed and they shouldn't be locking the stockroom.

 

Thank you.

 

 

1 REPLY 1

PritamG
Mega Guru

to remove a decommissioned stockroom referenced in closed disposal orders:

Navigate to the disposal order records and look for references to the stockroom and Manually clear the stockroom reference in related records if allowed.

If references prevent deletion, use a background script:

 

var stockroom = new GlideRecord('alm_stockroom');
if (stockroom.get('sys_id_of_stockroom')) {
    stockroom.deleteRecord();
}

 

Confirm that deleting references does not violate business rules or reporting.