I'm trying to write a SOQL
query for a Conga Composer button but I encounter errors. Below is the query - what's wrong with it? I was getting an error on the Product Code but seem to have that sorted, now the FISCAL_MONTHS
bit is throwing this error:
"value of filter criterion for expression FISCAL_MONTH(ScheduleDate) must be of type integer and should not be enclosed in quotes"
But it is an integer and isn't in quotes, isn't it?!
SELECT
SUM(Revenue) January
FROM
OpportunityLineItemSchedule
WHERE
OpportunityLineItem.Account_Record_Type_Id__c = '0120000000097XD'
AND
OpportunityLineItem.Sales_Person__c = '{pv0}'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'o'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'dsc-ot'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'd-o'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'aw'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'dsc-aw'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'd-aw'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'AD'
AND
OpportunityLineItem.PriceBookEntry.Product2.ProductCode = 'dsc-ad'
AND
FISCAL_MONTH(ScheduleDate) = 1
AND
FISCAL_YEAR(ScheduleDate) = THIS_FISCAL_YEAR