This topic contains 1 reply, has 0 voices, and was last updated by philip.lau@lollicup.com 6 years, 10 months ago.
- 
		AuthorPosts
- 
December 15, 2017 at 5:08 am #18095
 jmacdonaldHello, I have a script which sets values on the Inventory Details on a Stock Adjustment. This was working until today when it seems to have stopped, I am now getting the error “Please configure the inventory detail for this line.”. What I find weird is that when I try and set it to a Serial Number that I have already used I am getting the error “This serial number already exists in inventory. Please enter a different serial number.” so it seems like I am doing things correctly. Please see my script below, anyone have any ideas? Is this due to one of NetSuite’s silent updates? Code: 
 define([‘N/record’],
 function(record) {function onRequest(context) { 
 // We need to remove the generic item from stockvar inventoryAdjustment = record.create({ 
 type: record.Type.INVENTORY_ADJUSTMENT,
 //isDynamic: true
 });// Set the Adjustment Account 
 inventoryAdjustment.setValue({
 fieldId: ‘account’,
 value: 177
 });// Add the Item to be removed to the Inventory Sublist 
 inventoryAdjustment.setSublistValue({
 sublistId: ‘inventory’,
 fieldId: ‘item’,
 line: 0,
 value: 2144
 });// Set the adjust by quantity 
 inventoryAdjustment.setSublistValue({
 sublistId: ‘inventory’,
 fieldId: ‘adjustqtyby’,
 line: 0,
 value: ‘1’
 });// Set the location 
 inventoryAdjustment.setSublistValue({
 sublistId: ‘inventory’,
 fieldId: ‘location’,
 line: 0,
 value: 1
 });// Get the Inventory Details Subrecord 
 var inventoryDetails = inventoryAdjustment.getSublistSubrecord({
 sublistId: ‘inventory’,
 fieldId: ‘inventorydetail’,
 line: 0
 });inventoryDetails.setSublistValue({ 
 sublistId: ‘inventoryassignment’,
 fieldId: ‘quantity’,
 value: ‘1’,
 line: 0
 });inventoryDetails.setSublistValue({ 
 sublistId: ‘inventoryassignment’,
 fieldId: ‘receiptinventorynumber’,
 value: ‘IMEI1111’,
 line: 0
 });try{ 
 // Save the Inventory Adjustment
 var id = inventoryAdjustment.save({ignoreMandatoryFields: true});
 log.debug(‘id’, id);
 }catch(e){
 log.debug(‘e3’, e);
 log.debug(‘e3’, e.message);
 }
 }return { onRequest: onRequest }; }); 
 Sorry about the formatting, if I can’t figure this out I’ll log a case with NetSuite but it does seem something has changed on their end.
 This is a cached copy. Click here to see the original post.
- 
January 3, 2018 at 7:06 pm #18096
 philip.lau@lollicup.comHi jmacdonald: I hope you are aware the plus and minus for inventory adjustment has a different field to use. 
- 
		AuthorPosts
You must be logged in to reply to this topic.
