When the shipping method value is “Sample” the line level price level is set to custom. By default the rate should be set to the value 0.00.
function postSourcing(scriptContext) {
try {
var currentRec = scriptContext.currentRecord;
var shippingMethod = currentRec.getValue({
fieldId: 'custbody3'
});
var sublistName = scriptContext.sublistId;
var sublistFieldName = scriptContext.fieldId;
if (sublistName === 'item' && sublistFieldName === 'item') {
if (shippingMethod === 12 || shippingMethod === '12') {
var price = currentRec.setCurrentSublistValue({
sublistId: sublistName,
fieldId: 'price',
value: -1,
});
console.log("..price..", price);
currentRec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'rate',
value: '0.0'
});
}
}
} catch (err) {
console.log("....error@PostSourcing", err)
}
}