Adjust Consumable Quantity

Jon Collins2
Kilo Sage

Hi Folks, 

One of our asset users accidently input the quantity on a consumable record incorrectly and now our quantity is off. Is there a straight forward way to adjust the quantity on consumables?

Thanks in advance.

1 ACCEPTED SOLUTION

Scott Halverso1
Mega Guru
Mega Guru

I'm not aware of a non-platform adminstrator solution.  My hope is that when ServiceNow invests in Enterprise Asset Management, they add the ability to do quantity adjustments OOTB.

 

A script like this by a platform admin can correct it quickly.

var gr = new GlideRecord('alm_consumable');
if(gr.get('19d5c21f1be3a0505a448775cc4bcb37')){

    gr.quantity = '10'; //update quantity
    gr.update();
}

 

Alternatively the ACL from 2012 can be adjusted to restrict updating quantity to specific role to be able to adjust inventory counts.  The ACL is alm_asset.quantity, for writes.  Noone, not even admins can edit quantity.

View solution in original post

5 REPLIES 5

Scott Halverso1
Mega Guru
Mega Guru

I'm not aware of a non-platform adminstrator solution.  My hope is that when ServiceNow invests in Enterprise Asset Management, they add the ability to do quantity adjustments OOTB.

 

A script like this by a platform admin can correct it quickly.

var gr = new GlideRecord('alm_consumable');
if(gr.get('19d5c21f1be3a0505a448775cc4bcb37')){

    gr.quantity = '10'; //update quantity
    gr.update();
}

 

Alternatively the ACL from 2012 can be adjusted to restrict updating quantity to specific role to be able to adjust inventory counts.  The ACL is alm_asset.quantity, for writes.  Noone, not even admins can edit quantity.

Thanks Scott, I wasn't sure if there was an OOTB way to accomplish this; however, since this was a one-off issue that we are taking preventive measures to ensure doesn't happen again, your script worked perfectly to resolve the issue!

shloke04
Kilo Patron

Hi,

Couple of things to note here:

1) OOB there is no way to update the quantity as the field is a Read Only one.

2) If it is a One time activity you can write a Fix script and use the script shared below by Scott which will work. With Fix Script you do not need to write it every time and can execute it when you ever you want and also can be moved via Update Set as well to higher environment.

find_real_file.png

3) Alternatively, just to enhance this may be you can build a button on Consumable Form and make it visible to Admin, and they can update the Quantity using that button and every time they did not need to Run the script as well.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

CMDB Whisperer
Mega Sage
Mega Sage

I concur with others that have recommended a fix script if this is just a one-off, since running this as the system user will bypass the read-only ACLs and allow you to update it. 

On the other hand, that puts this in the hands of a system administrator rathe than an asset manager, which may not be ideal.  If you think this is a common enough scenario, then for greater governance you could create a catalog item for asset management category so that asset analysts could submit an inventory correction request.  That may seem like overkill, but this would ensure that there is approval by an asset manager, which may be important depending on the cost of the item and the number of assets you are adjusting it by.  If the asset manager reviews the request and approves it, the workflow can then apply the fix automatically.  While most consumables are lower in cost than hardware assets, a large number of them disappearing without a trace can still add up, so you may want some visibility and auditing behind these adjustments. 


The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.