When im running the below soql its work fine
SELECT BillingCountry,BillingCity, Industry, (SELECT Id, Name,Amount , StageName FROM Opportunities) FROM Account WHERE BillingCountry = 'USA'
its work fine but when i customized this query into
SELECT BillingCountry,BillingCity, Industry, (SELECT Id, Name,Amount , StageName FROM Opportunities) FROM Account
salesforce returing this error.
Here is the method where i run this query
public PageReference find()
{
String id = UserInfo.getUserId();
User activeUser = [Select Email From User where id = :id limit 1];
String email = activeUser.Email;
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://52.37.182.4/public/checkUser/'+email);
req.setMethod('GET');
req.setCompressed(false);
req.setBody('key1=value1&key2=value2');
req.setHeader('Content-Type', 'application/json');
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
}
Boolean userExsist = (Boolean)JSON.deserialize(res.getBody(), Boolean.class);
if(!userExsist)
{
showPopup();
return null;
}
lstResultWrapper = new List<ResultWrapper>();
for(Account c : [SELECT BillingCountry,BillingCity, Industry, (SELECT Id, Name,Amount , StageName FROM Opportunities) FROM Account WHERE BillingCountry='USA'])
{
req.setEndpoint('http://52.37.182.4/public/checkDeal/'+c.Opportunities[0].Name);
req.setMethod('GET');
req.setCompressed(false);
req.setBody('key1=value1&key2=value2');
req.setHeader('Content-Type', 'application/json');
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
return null;
}
Boolean dealExsist = (Boolean)JSON.deserialize(res.getBody(), Boolean.class);
// error indicating on the below line
ResultWrapper result = new ResultWrapper(c,c.Opportunities, !dealExsist);
lstResultWrapper.add(result);
}
return null;
}
Visual Force page
<apex:pageBlock id="tableId2">
<apex:outputText value="{!result}"></apex:outputText>
<apex:pageBlockTable value="{!lstResultWrapper}" var="items" id="table">
<apex:column headerValue="Deal Title">
<apex:outputText value="{!items['opportunity'].Name}"/>
</apex:column>
<apex:column headerValue="Deal Value">
<apex:outputText value="{!items['opportunity'].Amount}"/>
</apex:column>
<apex:column headerValue="Stage">
<apex:outputText value="{!items['opportunity'].StageName}"/>
</apex:column>
<apex:column headerValue="Industry">
<apex:outputText value="{!items['account'].Industry}"/>
</apex:column>
<apex:column headerValue="Country">
<apex:outputText value="{!items['account'].BillingCountry}"/>
</apex:column>
<apex:column headerValue="City">
<apex:outputText value="{!items['account'].BillingCity}"/>
</apex:column>
<apex:column headerValue="Action">
<apex:commandButton value="Find Clozer" onclick="displayResult" action="{!createDeal}" rendered="{!IF(items['isCreated'], false, true)}" rerender="tableId2,table" >
<apex:param name="title" value="{!items['opportunity'].Name}" assignTo="{!title}" />
<apex:param name="dealValue" value="{!items['opportunity'].Amount}" assignTo="{!dealValue}" />
<apex:param name="stageName" value="{!items['opportunity'].StageName}" assignTo="{!stageName}" />
<apex:param name="ind" value="{!items['account'].Industry}" assignTo="{!ind}" />
<apex:param name="count" value="{!items['account'].BillingCountry}" assignTo="{!count}" />
<apex:param name="cty" value="{!items['account'].BillingCity}" assignTo="{!cty}" />
</apex:commandButton>
</apex:column>
</apex:pageBlockTable>
for(List<Account>
... > but I don't know what your trying to do – EricSSH Apr 12 '16 at 17:27lstResultWrapper.add(result);
throws an exception of typeSystem.QueryException
? It seems rather impossible. – Bart Juriewicz Apr 12 '16 at 17:35