I am passing a lookup value to a custom workflow
<Input("SourceOriginatingaccount")> <ReferenceTarget("new_originatingaccounts")> Public Property SourceOriginatingaccount() As InArgument(Of EntityReference) Get Return m_SourceOriginatingaccount End Get Set m_SourceOriginatingaccount = Value End Set End Property Private m_SourceOriginatingaccount As InArgument(Of EntityReference)
when trying
Dim LookupOriginatingAccount As QueryExpression = New QueryExpression With {.EntityName = "new_originatingaccounts", .ColumnSet = New ColumnSet("new_sun", "new_sortcode", "new_accountnumber", "new_accountname"), .Criteria = New FilterExpression()} LookupOriginatingAccount.Criteria.AddCondition("new_originatingaccountsid", ConditionOperator.Equal, SourceOriginatingaccount.[Get](Of EntityReference)(executionContext)) Try Dim OriginatingAccountCollection As EntityCollection = service.RetrieveMultiple(LookupOriginatingAccount) If OriginatingAccountCollection.Entities.Count > 0 Then _strOrigSUN = CType(OriginatingAccountCollection.Entities(0).Attributes("new_sun"), String) _strOrigSortCode = CType(OriginatingAccountCollection.Entities(1).Attributes("new_sortcode"), String) _strOrigAccountNumber = CType(OriginatingAccountCollection.Entities(2).Attributes("new_accountnumber"), String) _strOrigAccountName = CType(OriginatingAccountCollection.Entities(3).Attributes("new_accountname"), String) End If Catch ex As Exception Using Errorprocessing As StreamWriter = File.AppendText("C:\Logs\ERROR.txt") Errorprocessing.WriteLine(ex.Message.ToString) End Using End Try
I get the error
Condition for attribute 'new_originatingaccounts.new_originatingaccountsid': expected argument(s) of type 'System.Guid' but received 'Microsoft.Xrm.Sdk.EntityReference'.
I am at a loss
*This post is locked for comments