How to set landed cost at line level in item receipt

First we need to enable the ‘landed cost per line’ then set the value using script.

let newRec = scriptContext.newRecord;

let landedCostField = newRec.getSublistSubrecord({                                       

sublistId: ‘item’,                                       

fieldId: ‘landedcost’,                                       

line: itemLine                                   

});                                   

// Set the landed cost in item line level                                   

landedCostField.setSublistValue({                                       

sublistId: ‘landedcostdata’,                                       

fieldId: ‘costcategory’,                                       

value: 2,                                       

line: 0                                 

});
                                   

landedCostField.setSublistValue({                                       

sublistId: ‘landedcostdata’,                                       

fieldId: ‘amount’,                                       

value: itemLandedCost,                                       

line: 0                                   

});

Leave a comment

Your email address will not be published. Required fields are marked *