I have a custom sublist in a sales order with a sc...
# suitescript
p
I have a custom sublist in a sales order with a script attached to it that recalcs the lines on the sublist whenever a new sublist item is added. What is happening though is that if I add a new item on a different sublist (ie. the items sublist) the recalc is also triggering in my custom sublist. Is this supposed to happen? I thought the recalc would only trigger if a new item is added to the sublist I specified in my script.
e
SS1 or SS2?
p
ss1 this is part of the script (condensed for posting)
Copy code
function dimsTotalSumEst(type, form, request){                  
        var totalWeightLbs = 0;
        var gridTotalWeightLbs = nlapiGetCurrentLineItemValue('recmachcustrecord_1','custrecord_total_weight_lbs');                                    
        var lines = nlapiGetLineItemCount('recmachcustrecord_1');                    
       for(var i = 1; i <= lines; i++){                 
         if (gridTotalWeightLbs) { totalWeightLbs = totalWeightLbs + parseFloat(nlapiGetLineItemValue('recmachcustrecord_1', 'custrecord_total_weight_lbs', i));}
      }
      if (gridTotalWeightLbs > 0){ nlapiSetFieldValue('custbody87',totalWeightLbs)};
      }
e
Are you using the recalc event?
or validateLine?
Nvm, either one has a "type" parameter which is the sublist id. So add this as the first line of your function
if (type != "idofthesublistyoucareabout") return true;
p
Thanks!