- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 06:10 PM
Stockroom -> alm_stockroom
Consumable -> alm_consumable
i tried to use this qualifier on the consumable but i kept getting everything not the one specified to the selected stock room
javascript: "install_status=6^stockroom=" + current.getValue('stockroom');
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 07:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 07:16 PM
@chercm It is a custom field change your reference qualifier to this.
javascript : "install_status=6^stockroom=" + current.u_stockroom;
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 08:42 PM
Hi @chercm
What I understood is you are expecting to deduct the stock when a Catalog Task is closed.
Try creating a business rule like the one below.
Name: Deduct asset quantity from stock
Table: sc_task
Advanced: True
When to Run Section:
When: After
Insert: True
Update: True
Conditions:
Asset :: is Not Empty
Stock Room :: is Not Empty
State :: Changes to :: Closed Complete
Advanced Section:
Script:
(function executeRule(current, previous){
var almGr = new GlideRecord('alm_asset');
almGr.addQuery('sys_id', current.u_reference_1);
almGr.query();
if(almGr.next()){
var quantity= almGr.getValue('quantity');
var req_quantity= current.request_item.quantity;
try{
quantity = quantity - req_quantity;
if(quantity >= 0){
almGr.setValue('quantity', quantity);
almGr.update();
} else{
gs.addErrorMessage('Available quantity is less than the requested quantity, unable to update the stock.');
}
}catch(ex){
gs.addErrorMessage('Unexpected Error:' + ex.message);
}
}
}
)(current, previous)
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 07:57 AM
@AnveshKumar M @Danish Bhairag2 Does SC_task table contain the column requested_for ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 08:38 AM
Hi @chercm ,
no it does not but you can dot walk like this highlighted in below snip from sc_task table.
Mark my answer helpful & accepted if it helps you resolve your issue.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 01:26 AM - edited 10-08-2023 05:07 AM
@AnveshKumar M @Danish Bhairag2 if I need to have reporting on this that ticket being recorded for what asset taken , do I need to create a column in the consumable table ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 05:35 AM
Hi @chercm ,
You don't need to . You can create a report on requested item table where u can select the respective item by dot walking, also if u scroll down at the very bottom on the left hand side while choosing columns you will get a option for adding variables where u can select the item n bring that field into the report which u have created on the form.
Let me know if you are able to find it or not. I will try to add snips in case if you are not able to.
Mark may answer helpful & accepted if it helps you resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 05:55 AM - edited 10-08-2023 05:59 AM
Hi @chercm ,
Adding snips for your reference.
Create a report on RITM(sc_req_item) table. Go to configure & press choose column.
U will get the below thing appearing.
Click on the icon which is highlighted in yellow color after selecting variable field. Then select your respective catalog item. Once u select that u will get the list of variables under that item.
Once i selected one of my catalog item. all the variables under it will appear to you for selection. Select your desired field & move to the right hand side. & press ok.
You should be able to see for each Request what was the asset/Consumable requested.
Mark my answer helpful & accepted if it helps you resolve your query.
Thanks,
Danish