ConditionExpression error “expected argument(s) of type ‘System.Guid’ but received ‘System.Guid[]”

Today while writing query expression I was getting error:

Condition for attribute ‘sf_contract.contractid’: expected argument(s) of type ‘System.Guid’ but received ‘System.Guid[]’.

We can pass a single or multiple values in ConditionExpression using appropriate comparison operator(s). In this example ConditionExpression was comparing multiple GUID values (stored in object array) with an attribute using “IN” comparison operator.

ConditionExpression have a few constructors, and I was trying to use one that accepts params object[] as argument but it didn’t work as per expectation.

This error was gone when I changed my collection to attribute’s base type, so basically I changed object[] to Guid[]. Hope this explanation will save someone’s time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s