I'm working on an automation that will email a request to a user if they are listed with a specific role as a sales team member on an opportunity. For some reason, I cannot even get this for loop to return the sales team members on an opportunity when the script is run. I'm sure I'm missing some small item, I would like to get a second set of eyes on the code to see if anything can be spotted.
function cs_EmailEngineer(){ console.log("Request SOW Button Pressed"); nlapiLogExecution('debug', 'email sent', 'Email was sent'); console.log("It got passed the email was sent log execution line"); nlapiSendEmail(14240, "engineer@company.com", "SOW Needed", "Please start process for SOW. This relates to Opportunity " + x); for (var y = 1; y <= nlapiGetLineItemCount('salesteam'); y++) { nlapiLogExecution('DEBUG', 'sales role', y); var z = nlapiGetLineItemValue('salesteam', 'salesrole', y); nlapiLogExecution('DEBUG', 'sales role', z); } }For reference, I know the script is being executed as both console.log functions are returning the string to the console.The script record is active in our environment and it has been properly deployed to the record type.