I have the spring 15 version on my organization. In the Developer Console I wrote this query "Select Id, Name From Territory2", and I got the results (The Ids and the Names of Territories). But when I put this query "Select Id, Name From Territory2 Where Name = 'x' " (x : existing name of a territory), I didn't get any result but in fact I have a data for this query. I tried the query : "Select Id, Name From Territory2 Where Name like '%x%'", and no result too.(All queries returns data (The order by Name working fine too) except when I put the condition "Where Name [...]")

This happen in sandboxes with spring version(not production), in Production sandbox and the sandboxes with summer release everything is good (the two queries return results).

Did someone have this problem? Did someone find any solution? Please advice.

Thank you in advance

  • Did you try the second query in the Developer Console too? – Ruslan Vekua May 20 '15 at 7:26
  • yes sure I tried it but no result found – BBS_ May 20 '15 at 7:33
  • Have you tried refreshing your sandboxes? – crmprogdev May 20 '15 at 13:20
  • No I can't refresh the sandboxes – BBS_ May 21 '15 at 5:59

I use this query "Select Id, Name From Territory2" and I do my own filtering by code. Here the code :

Set setTerr = new Set(); //adding the names of territories setTerr.add('X');//...

//Select all existing territories Map mappingTerr = new Map([Select Id, Name From Territory2]);

List listTerr = new List();

//For each territory check if it contains the name of territory in the set
for(String territory_id : mappingTerr.keySet()){ if(setTerr.contains(mappingTerr.get(territory_id).Name)){ //Adding result in a list listTerr.add(mappingTerr.get(territory_id));
} }

  • Can you add the code so this is of more use to others in the future? – Matt Lacey May 29 '15 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.