1

Is there is any way we can filter out zones for community ? I want only those zone to appear which are related to Idea object.

I have some zones for Idea object and some for Question object.

But when i query on community

[select id,name from community where isActive=true];

I get list of all the Zones.

Also when looking at the API doc, I didn't find any field that can work to filter. https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_community.htm

using the NetworkId gives the community name.

1 Answer 1

0
  Set<Id> cmmIds=new Set<Id>();
  for(Idea i:[Select communityId from Idea]){
    cmmIds.add(i.communityId );
  }
  List<Community> lstzones=[Select Id,Name from community where Id In :cmmIds];

The above filter ideas community Id and then use that to fetch Zones .

5
  • Weird error : sObject type 'zone' is not supported ! Commented Sep 26, 2014 at 6:52
  • Thanks Mohith !!! , A slight update to your code is needed Set<Id> cmmIds=new Set<Id>(); for(Idea i:[Select communityId from Idea]){ cmmIds.add(i.communityId ); } List<community> lstzones=[Select Id,Name from community where Id In :cmmIds]; Commented Sep 26, 2014 at 7:03
  • The zone is no where in API its still community here is the note from the API docs--- Starting with the Summer ’13 release, Chatter Answers and Ideas “communities” have been renamed to “zones.” In API version 28, the API object label has changed to Zone, but the API type is still Community. Please edit the code as per above comment so that i can mark it solution. Commented Sep 26, 2014 at 7:05
  • Mohith --please apply [] in for loop query and its ready to go. i was unable to edit as this is small change. Commented Sep 26, 2014 at 7:14
  • @Sagar answering with mobile while travelling ..corrected Commented Sep 26, 2014 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .