简体   繁体   中英

Netsuite - How to get Inventory Adjustment worksheet records using a restlet

I am trying to get a record of an Inventory Adjustment worksheet and getting the error:

{'error': {'code': 'INVALID_TRANS_TYP',
  'message': '{"type":"error.SuiteScriptError","name":"INVALID_TRANS_TYP","message":"Transaction type specified is incorrect.

My code is below:

/**
 * @NApiVersion 2.0
 * @NScriptType Restlet
 * @NModuleScope SameAccount
 */

define([
    'N/record',
], function(record) {
    function getInv(data){
    var recordObj = record.load({
        type: "inventoryadjustment",
        id: data.rec,
        isDynamic: true
    });

        return recordObj;
    }
    return {get:getInv};
});

When I go to Transactions>Inventory>Adjust Worksheet>List I can see the list of all inventory adjustments with their ids. The url shows transaction type as Transaction_TYPE=InvWksht ,not sure what that should be in script. How can I get this working?

Generally you would prepare a CSV and import it. Note that an inventory adjustment worksheet sets inventory levels and valuation to fixed values at a given point in time with the transactional effect being whatever changes are required to do that. It is not something you would do often.

Inventory Adjustments and Inventory Counts are the common method to adjust inventory levels but only allow you to set costs for the adjusted qty.

  • Worksheet: as of start of day 6 Jan 2021 make it so we have 200 Widgets worth $5000 total.
  • Adjustment: add 25 widgets at $25 each to the current 175. We end up with 200 widgets worth $5000 total.
  • Inventory count: supposed to be 25 in BIN XXXAAA but there are 50. Effect is to adjust in 25 at the current average cost. We end up with 200 worth $5000 total.

Far as I know Inventory Worksheets are not scriptable.

Finally got this working. I simply had to change the type to inventoryworksheet

/**
 * @NApiVersion 2.0
 * @NScriptType Restlet
 * @NModuleScope SameAccount
 */

define([
    'N/record',
], function(record) {
    function getInv(data){
    var recordObj = record.load({
        type: "inventoryworksheet",
        id: data.rec,
        isDynamic: true
    });

        return recordObj;
    }
    return {get:getInv};
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM