Function to add an item to the sublist in a Record

    /**
        * Function to add item to the sublist
        * @param {object} currentRec - current quote record
        * @returns {boolean} true - if the value is not empty
        */
     function addFreightLine(currentRec) {
       try {        
           // to select the new line
           currentRec.selectNewLine({
             sublistId: 'item',
 
           });
           currentRec.setCurrentSublistValue({
             sublistId: 'item',
             fieldId: 'item',
             value: "3587",           
             forceSyncSourcing: true

           });
           currentRec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: 1,forceSyncSourcing: true });
           currentRec.setCurrentSublistValue({sublistId:'item',fieldId:'pricelevels',value:-1})
           currentRec.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'rate',
            value: Number(0),
            forceSyncSourcing: true
          });
          currentRec.commitLine({
            sublistId: 'item'          
          });                                 
       }
       catch (e) {
         log.debug("error @ addFreightLine", error);
       }
     }

Leave a comment

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