Update from Salesforce - confirmed that
Mine_And_My_Groups scope is only valid for
I think there's a couple of issues here:
I think the Salesforce USING SCOPE documentation is wrong, and the correct scope is probably
Mine_And_My_Groups, which matches the other syntaxes e.g.
Mine_And_My_Groups, it's either never been implemented for most/all objects (other than
ProcessInstanceWorkItem) or has ceased working at some point
I can successfully query
USING SCOPE Mine_And_My_Groups, and in a dev org it returns Approval items assigned to me or to queues I'm a member of.1
Querying in the dev console or through SOAP API gives different results depending on scope.
SELECT Id FROM Case USING SCOPE MineAndMyGroups fails to execute
ERROR at Row:1:Column:33 Invalid query scope: MineAndMyGroups, whereas
SELECT Id FROM Case USING SCOPE Mine_And_My_Groups executes but then returns an error when retrieving results,
Invalid query scope: Mine_And_My_Groups.2
Similarly they are different in execute anonymous.
System.debug([SELECT Id FROM Case USING SCOPE MineAndMyGroups]); returns a compile failure, using
Mine_And_My_Groups compiles but returns a runtime exception, both errors are
Invalid query scope: <SCOPE>
I've checked combinations of the following scenarios being true and false which have no effect on the behaviour:
- A queue exists
- A queue exists which can own the object I'm querying
- A queue exists which I am a member of
- A record exists which is owned by a queue
I've tried with the following objects:
ListView and managed and unmanaged Custom Objects. Even if this worked for other objects, I think there's the potential for
ListView to not be supported as it's a crossover between data and metadata.
This might not be the only part implemented functionality in the
1 In my current scratch org it strangely only returns approval items from my queues and not those assigned to me.
2 Interestingly this is also the case for