Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
Count Line Items
I have been working on the following script that we want to count the number of line items if the custom column field ecertificate = T and the item type name is serialized inventory.
I am getting this error: ReferenceError: "CountTotal" is not defined. (Digital Delivery Count .js#8)
function calculatedigitaltotal() {
for( var i = 1; i <= nlapiGetLineItemCount('item'); i++) {
var eCertificate = nlapiGetLineItemValue('item', 'custcol_ecertificate', i );
var itemTypeName = nlapiGetLineItemValue('item', 'itemtype', i);
if ( eCertificate == 'T' && itemTypeName == 'Serialized Inventory Item') {CountTotal = eCertificate++
}
}
nlapiSetFieldValue('custbody_ecertificate_count', CountTotal, false, false);
return true;
}