Is it possible to use $expand
but instead of returning a collection of objects, just return the count of objects?
For example, get an account and a count of its annotations in a single WebApi call
I've tried a few things.
Obvious attempt:
accounts(6CDEEB72-2AC8-E711-A825-000D3AE0A7F8)?$select=name&$expand=Account_Annotation($count=true)
returns all fields of all Annotations but doesn't count anything.Next I tried
accounts(6CDEEB72-2AC8-E711-A825-000D3AE0A7F8)?$select=name&$expand=Account_Annotation($select=annotationid&$count=true)
returns an error: "Found an unbalanced bracket expression". I think this is related to the & symbol in the$expand
I found a non-crm blog that said this could be resolved with a ; but when I tried
accounts(6CDEEB72-2AC8-E711-A825-000D3AE0A7F8)?$select=name&$expand=Account_Annotation($select=annotationid;$count=true)
it doesn't give an error, but the$count
instruction seems to be ignoredA crazy attempt of
accounts(6CDEEB72-2AC8-E711-A825-000D3AE0A7F8)?$select=name&$count=Account_Annotation($select=annotationid)
returns a "not a valid count" error
I'm guessing that this is not a valid combination, but I thought I would post here in case someone else has achieved this successfully.