You need to sign in to do that
Don't have an account?
Javascript Remote results differ from query results
Hello -
I've ran into a strange issue I haven't seen before when using a Javascript remote function to return the results of a query..
I have a method that returns the results of a query on the Opportunity object:
@RemoteAction Public static AggregateResult[] myOppsQuery { List<AggregateResult> ar = [Select Calendar_Quarter(CloseDate)Quarter, Sum(Commissionable_Margin__c)Margin from Opportunity where CloseDate = THIS_YEAR AND isWon = TRUE Group By Calendar_quarter(CloseDate) Order by Calendar_quarter(CloseDate)]; return ar; }
When this method is invoked by the javascript remote function the results I am getting differ from the results of the query by itself. Copy/pasting the query from the method into SoqlXplorer returns the correct value, but the javascript remote function results are not the same.
Is there some sort of caching of a previous value going on here? I've cleared browser cache + tried different browsers but the issue persists.
Thanks in advance for taking a look at this - any assistance is greatly appreciated.
Have you confirmed that you are executing the SOQL as the same user between both tests (JS Remote and SOQLExplorer)?
On your Apex Class, what is the Sharing Clause (With or Without Sharing)?
I would confirm that the OWD settings for Opportunity are set to ensure that visibility is there for the profiles you are working with.
All Answers
Have you confirmed that you are executing the SOQL as the same user between both tests (JS Remote and SOQLExplorer)?
On your Apex Class, what is the Sharing Clause (With or Without Sharing)?
I would confirm that the OWD settings for Opportunity are set to ensure that visibility is there for the profiles you are working with.
Turned out to be a visibility issue I had overlooked - thank you :)