Unable to set value in stockroom field from a staging form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 08:45 AM
Hi Team,
Facing issues while passing value to this field from a custom staging form's u_stockroom reference field I am trying to pass through a glide record insert, but it's not setting and being blank. Please see below code snippet:-
var stock = new GlideRecord('alm_asset');
stock.addQuery('serial_number', dataRows.serial_number);
stock.queryNoDomain();
//gs.addInfoMessage('Before If Stockroom');
if(stock.next()){
stock.stockroom.value = current.u_stockroom;
stock.update();
gs.addInfoMessage('Inside If Stockroom');
}
Somewhere I read someone said in this thread:- How to import XLS data to Stockroom :- 4) try to figure how to link the assets to the stockroom (the field Stockroom on the asset table seems interesting :))
Can you or someone please put some light on it.
Thanks,
Pabitra
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 08:53 AM
Hi There,
Actually from a staging form, we have a transformation script to trigger a mapping and there is one Business Rule runs insert/update on this staging form, to check and create/update the Asset with all necessary details like IMEI, Serial Number, etc from file, and stockroom from staging form where user selects manually.
var stock = new GlideRecord('alm_asset');
stock.addQuery('serial_number', dataRows.serial_number);
stock.query();
if(stock.next()){
stock.stockroom = current.u_stockroom; // Both are reference fields points to alm_stockroom table.
stock.update();
}
Thanks,
Pabitra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 09:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 10:15 AM
Hi Chirag,
Thanks for your reply and finding. But I tried to disable this BR, still it's not setting up anything in Stockroom field. And also I am also passing In Stock and Available as Status and Sub Status in device record.
Could be something else...
Actually there is a table to which I am inserting/update the data "u_cmdb_ci_hardware_user_device" which is inherited from alm_asset and when I try to create a new device manually and set Stockroom, it gets cleared and then it becomes read only as per some property set for this field. So to update stockroom need to open the asset record either from alm_asset or alm_hardware table and save the value to reflect back in child table mentioned above.
Thanks again,
Pabitra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 10:20 AM
Thanks.
Can you check "Create Stockroom Model Relation" business rule ? I think, that is stopping you.
