Passing a guid as a crm filter option

1

I am trying to use a GUID field from CRM4 database via a WSDL query but I am unsure as to how to pass multiple guid values into the database, if I try to do this it results in an error:

0x80040216 An unexpected error occurred. Platform

The code that I am passing in is as follows:

Dim cond2 As CrmService.ConditionExpression = New CrmService.ConditionExpression
cond2.Operator = CrmService.ConditionOperator.In
cond2.AttributeName = "createdby"
cond2.Values = {"3398448B-D65B-E611-95A2-000D3AB23B6B", "1196E35B-E05B-E611-95A2-000D3AB23B6B"}

Any idea as to what might be causing this error and how I can correctly pass multiple guid values into the condition values.

I have also tried:

cond2.Values = {New Guid("3398448B-D65B-E611-95A2-000D3AB23B6B"), New Guid("1196E35B-E05B-E611-95A2-000D3AB23B6B")}

And also:

Dim testGuid As New UniqueIdentifier
testGuid.Value = New Guid("1196E35B-E05B-E611-95A2-000D3AB23B6B")
testGuid.IsNull = False
sql
sql-server
dynamics-crm-4
asked on Stack Overflow Aug 15, 2016 by Jay

1 Answer

0

Try building an array first defined as type of Guid.

Dim values As Guid() = New Guid() {a_guid, another_guid}
Dim c As New ConditionExpression("createdby", ConditionOperator.[In], values)
answered on Stack Overflow Aug 15, 2016 by James Wood • edited Aug 19, 2016 by James Wood

User contributions licensed under CC BY-SA 3.0