Function To Remove Item Line from a Record

 /**
        * Function to remove the line item
        * @param {object} currentRec - current record
        * @jj0189remyaturns {boolean} true - if the value is not empty
        */
         function removeItem(currentRec) {
           try {    
             let lineCount = currentRec.getLineCount({
               sublistId: 'item'
             });  
             console.log("lineCount",lineCount)
             if ( lineCount > 0) {
              
                 let lineNumber = currentRec.findSublistLineWithValue({
                   sublistId: 'item',
                   fieldId: 'item',
                   value: 3587,
               
               });
               currentRec.removeLine({
                 sublistId: 'item',
                 line: lineNumber,                             
             });                     
             
             }  
                     
           }
           catch (e) {
             log.debug("error @ removeItem", e);
             return false;
           }
         }

Leave a comment

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