RE: Removeline function is not working
I have created a Sales Order and I want to remove one line from the Sales Order using the subscript , I am using the below code
=========================================
var ObjRec = context.currentRecord;
ObjRec.removeLine({
sublistId: ‘item’,
line: ‘1’,
ignoreRecalc: true
});
=========================================
Pl suggest.
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define([‘N/record’,’N/error’,’N/ui/message’],
function(record,error,message) {
function beforeLoad(context) {
}
function beforeSubmit(context) {
// when we edit a SO Record and then again hit the save button I want to remove the 1 line of line level
var ObjRec = context.currentRecord;
ObjRec.removeLine({
sublistId: ‘item’,
line: 1,
ignoreRecalc: true
});
alert (“Here we are removing the line”);
}
function afterSubmit(context) {
}
return {
beforeLoad: beforeLoad,
beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};
});