suitescript search: get inventory adjustment and i...
# ask-stanley-ai
m
suitescript search: get inventory adjustment and its line items
c
AI generated answer (using internal Slack threads):
To get inventory adjustment and its line items using SuiteScript, you can use the
N/record
module to load the inventory adjustment record and then iterate over its line items. Here is a sample code snippet:
Copy code
javascript
var record = require('N/record');

// Load the inventory adjustment record
var inventoryAdjustment = record.load({
    type: record.Type.INVENTORY_ADJUSTMENT,
    id: 'your_inventory_adjustment_id'
});

// Get the count of line items
var lineCount = inventoryAdjustment.getLineCount({
    sublistId: 'inventory'
});

// Iterate over each line item
for (var i = 0; i < lineCount; i++) {
    var itemId = inventoryAdjustment.getSublistValue({
        sublistId: 'inventory',
        fieldId: 'item',
        line: i
    });

    var quantity = inventoryAdjustment.getSublistValue({
        sublistId: 'inventory',
        fieldId: 'adjustqtyby',
        line: i
    });

    // Do something with itemId and quantity
}
This code will load an inventory adjustment record and then iterate over its line items, retrieving the item and quantity for each line. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854431272
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854370177
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848938
Please provide your feedback on this answer.