Hello. In client script, when you try to add an it...
# suitescript
b
Hello. In client script, when you try to add an item in Sales Order, I want to show custom price. However as native NS populates Price Level as Base and it updates that rate column. I was trying to do that in
fieldChanged()
entry point like this but does not work.
Copy code
function fieldChanged(scriptContext) {
        try {
            if(scriptContext.sublistId == "item" && scriptContext.fieldId == "item"){
                    scriptContext.currentRecord.setCurrentSublistValue({
                        sublistId: "item",
                        fieldId: "price",
                        value: -1
                    });
})
When I output console, I can see my function runs before other column field changed triggered. Any help would be appreciated. Also I tried to
else if(scriptContext.sublistId == "item" && scriptContext.fieldId == "rate"){
but somehow this sections runs several times
a
You can use the
postSourcing
event(entry point) for that, when a line item is selected the
fieldChanged
event is triggered (fieldId: item, sublistId: item) but also a
postSourcing
event is triggered and that one happens after the fields are populated with sourcing values.