I am trying to return the number of products of with the ProductName = EAP related to an Opportunity. Here is my code:
function getProductTypes (oppId) {
var result = sforce.connection.query("Select COUNT() From OpportunityLineItem where OpportunityId = '" + oppId + "' and PricebookEntry.Product2.Name IN ('EAP') ");
return result;
}
What I want to do is return the number of number of "EAP" products related to the opportunity so then in the below code block, I can determine another piece of code to run:
if(getProductTypes('{!Opportunity.Id}') >= 1){
//run this code!
}else{
//run this code instead!
}