1
我試圖返回與ProductName = EAP有關的商機的產品數量。這裏是我的代碼:在JavaScript函數中從SOQL查詢中返回Count()
function getProductTypes (oppId) {
var result = sforce.connection.query("Select COUNT() From OpportunityLineItem where OpportunityId = '" + oppId + "' and PricebookEntry.Product2.Name IN ('EAP') ");
return result;
}
我想要做的就是返回相關的機會,使然後在下面的代碼塊「EAP」的產品數數,我能確定另一段代碼來運行:
if(getProductTypes('{!Opportunity.Id}') >= 1){
//run this code!
}else{
//run this code instead!
}
謝謝你,完美的作品! :) – user3582197