I have to filter RelatedItemID column from workflow task list using CAML query to get only those records that match the MAIN itemID from its corresponding main list. How do I achieve this? I tried the below query and it's surprising to know that it doesn't work, rather the query returns all records irrespective of the below filter that applied.
1 Answer
Per my test, I could reproduce you issue on my end.
Seems that the character '
cannot be encoded correctly, try to replace it with "
and remove the slash \
. Also you need to change the Eq
to Contains
.
Here is my demo for you:
camlQuery.ViewXml =
@"<View>
<Query>
<Where><Contains><FieldRef Name='RelatedItems' /><Value Type='RelatedItems'>[{"ItemId":14,"WebId":"c1220a37-046e-4c95-9e32-803fd4d54caa","ListId":"8bb17903-679e-4ef9-9826-d61b19289703"}]</Value></Contains></Where>
</Query>
<ViewFields><FieldRef Name='RelatedItems' /></ViewFields>
</View>";
-
Thanks you so much Michael. This solved the issue which i was facing....– anymoCommented Mar 31, 2020 at 7:01
-