You need to sign in to do that
Don't have an account?
Iterating Group standard object records in salesforce
The following in the SOQL query for Users
List<User> u = [SELECT Id FROM User];
Am able to get the id to iterate. Now i would like to get the id of Group standard object
List<Group> g = [SELECT Id FROM Group];
List<EntitySubscription> es1 = [select Id from EntitySubscription where SubscriberId =: j and ParentId NOT IN :usr ];
am retriving all entity subscriptions whose subscriber id not in the list of users. It is working fine. Now i want to retrive the entity subscriptions whose subscriber id not in the group also. For that i am writing the query like as above
List<EntitySubscription> es1 = [select Id from EntitySubscription where SubscriberId =: j and ParentId NOT IN :grp ];
Am getting the following error.
Error: AutoDeleteSubscriptions2 Compile Error: Invalid bind expression type of SOBJECT:Group does not match domain of foreign key
Please any one can help me on this how to retrive the entity subscriptions whose subscriber id not in the group.
the group is containing other groups ,users,roles and subordinates all so how to check that one in this. Please give idea on this.
Try this :
It should help you
List<ID> gg = new List<ID>();
List<Group> grp = [SELECT Id FROM Group];
for(Group Gr:grp)
gg.add(Gr.Id);
List<EntitySubscription> es1 = [select Id from EntitySubscription where SubscriberId =: j and ParentId NOT IN :gg];
Thanks,