How to update the price level of an item under Sal...
# ask-stanley-ai
v
How to update the price level of an item under Sales/Pricing using a script?
c
AI generated answer (using internal Slack threads):
To update the price level of an item under Sales/Pricing using a script, you can use SuiteScript's
record
module to load the item record, set the new price level, and then save the record. Here is a sample code snippet:
Copy code
javascript
/**
 *@NApiVersion 2.x
 *@NScriptType Suitelet
 */
define(['N/record'], function(record) {
    function onRequest(context) {
        var itemId = 123; // replace with your item's internal id
        var newPriceLevel = 4; // replace with your new price level's internal id

        var itemRecord = record.load({
            type: record.Type.INVENTORY_ITEM, // or the appropriate item type
            id: itemId
        });

        itemRecord.setValue({
            fieldId: 'pricelevel',
            value: newPriceLevel
        });

        itemRecord.save();
    }

    return {
        onRequest: onRequest
    };
});
This script loads the item record, sets the new price level, and then saves the record. Replace
123
with the internal ID of the item you want to update, and
4
with the internal ID of the new price level. Please note that this script is a Suitelet, but you can adapt it to other script types as needed. Also, make sure to replace
record.Type.INVENTORY_ITEM
with the appropriate item type if you're not updating an inventory item. ****** 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.859012
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856172323
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855745912
Please provide your feedback on this answer.