this is probably a noob question.... but I am tryi...
# suitescript
m
this is probably a noob question.... but I am trying to add a 10% markup to the shippingcost field of the item fullfilment record in "beforeSubmit" context and setValue isn't working... what piece of the puzzle am I missing?
function beforeSubmit(scriptContext) {
var thisRecord = scriptContext.newRecord;
var shipping = parseFloat(noNull(thisRecord.getValue('shippingcost')));
var shipHawkCost = parseFloat(noNull(thisRecord.getValue('custbody_shiphawk_shipping_cost')));
if(noNull(shipHawkCost)){
log.debug('shipHawkCost',shipHawkCost);
log.debug('shipping-before',shipping);
shipping = shipHawkCost+(shipHawkCost * .1);
thisRecord.setValue('shippingcost', shipping.toFixed(2));
log.debug('shipping-after',shipping);
log.debug('shipping-afterround',shipping.toFixed(2));
}
}
s
Some default mechanism might be overwriting your value, or some other code/workflow?
m
shippingcost just stays blank
b
is there a shipping method?
m
no. is that required?
b
yes
in general, you should only attempt to do something in script after you know how to do it in the ui