``` const beforeSubmit = (scriptContext) => { ...
# suitescript
k
Copy code
const beforeSubmit = (scriptContext) => {

            var newRecord = scriptContext.newRecord

            var oldRecord = scriptContext.oldRecord

            var value = newRecord.getValue({
                fieldId: 'custitem6'
            })

            var objRecord = record.load({
                type: record.Type.INVENTORY_ITEM,
                id: 409,
                isDynamic: true,
            });


            var value = objRecord.selectLine({
                sublistId: 'price1',
                line: 1
            })

            var headerField = objRecord.setCurrentMatrixSublistValue({
                sublistId: 'price1',
                fieldId: 'price',
                column: 1,
                value: 200
            });
b
what does the pricing sublist look like
k
message has been deleted
b
not actually a matrix
k
What is it and how do I change the values with script?
b
go over Pricing Sublist / Pricing Matrix to see which features influence your choice of method
else you need to learn how to work with sublists, in which case you want to start with the N/record Samples
k
Copy code
var itemRecord = record.load ({
    type: record.Type.INVENTORY_ITEM,
    id: itemId
});
var qtyPriceSchedule = itemRecord.getValue({
    fieldId: 'quantitypricingschedule'
});

// Set the base price
var basePrice = 100;

// You must select, set, and then commit the sublist line you want to change.
itemRecord.selectLine({
    sublistId: priceID,
    line: 1
});
itemRecord.setCurrentMatrixSublistValue({
    sublistId: priceID,
    fieldId: 'price',
    column: 1,
    value: basePrice
});
itemRecord.commitLine({
    sublistId: priceID
});

// Get the number of columns in the price matrix
// Each column represents a different quantity level
columnCount = itemRecord.getMatrixHeaderCount({
    sublistId: priceID,
    fieldId: 'price'
});
I been using this code and I keep getting errors that none of the functions work on the record:
TypeError: itemRecord.setCurrentMatrixSublistValue is not a function [at Object.beforeSubmit (/SuiteScripts/PriceLevelFieldUpdate/PriceLevelUEScript.js6224)]
@battk
am I not referencing the correct object
you wont get much futher without going through the documentation thats been linked