Pregunta

I created a custom javascript button in developer environment that has the below function to determine the amount of products attached to the Opportunity with a specific Product Name. I am getting a malformed query error from this function:

function getProductTypes (oppId) { 
var result = sforce.connection.query("Select COUNT(Id) prodCount From OpportunityLineItem where OpportunityId = '" + oppId + "' and PricebookEntry.Product2.Name IN ('EAP') "); 
var count = result.records.prodCount; 
return count; 
} 

What I don't understand is that in my salesforce developer environment, this button works 100% but when I went to install this into a client's developer sandbox, it gave me the malformed query error: Aggregate query not allowed with this api version. Is there a setting that I need to change in their dev environment or is there something really wrong with my code?

Thanks!

Rachel

¿Fue útil?

Solución

Check the version number in your {!REQUIRESCRIPT("/soap/ajax/(here!)/connection.js")}.

Probably it's something ancient like "13" they still have in the docs.

There's also non-zero chance that this function tries to be smart and doesn't include the connection.js if one of previous buttons has used it. Check the custom JS buttons that load before yours on your client's page layout and bump them all up?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top