CRM2016 On Premises
I have a custom entity new_transactionsets . Account has a 1:N relationship to new_transactionsets (new_licenceid)
I am trying to run a Querybyexpression on new_transactionsets
Dim SearchQuery As QueryExpression = New QueryExpression("new_transactionsets") SearchQuery.ColumnSet = New ColumnSet("new_serialnumber", "new_submissionvalue", "new_noitems") SearchQuery.Criteria.FilterOperator = LogicalOperator.And SearchQuery.Criteria.AddCondition("new_transactionsetsid", ConditionOperator.Equal, context.PrimaryEntityId.ToString) Dim LinkEntityB As LinkEntity = New LinkEntity() With { .LinkFromEntityName = "new_transactionsets", .LinkToEntityName = "account", .LinkFromAttributeName = "new_licenceid", .LinkToAttributeName = "accountid", .JoinOperator = JoinOperator.LeftOuter, .Columns = New ColumnSet("name"), .EntityAlias = "B" } LinkEntityB.LinkCriteria.AddCondition("accountid", ConditionOperator.Equal, "new_licenceid") SearchQuery.LinkEntities.Add(LinkEntityB) Dim SearchQueryCollection As EntityCollection = service.RetrieveMultiple(SearchQuery) If SearchQueryCollection.Entities.Count > 0 Then For Each _returnedresult In SearchQueryCollection.Entities _serialnumber = _returnedresult.Attributes("new_serialnumber").ToString _licencenumber = _returnedresult.Attributes("name").ToString _submissionvalue = _returnedresult.Attributes("new_submissionvalue").ToString _itemcount = _returnedresult.Attributes("new_noitems").ToString Exit For Next ' Write out for testing WriteToErrorLog("_serialnumber " & _serialnumber.ToString) WriteToErrorLog("_licencenumber " & _licencenumber.ToString) WriteToErrorLog("_submissionvalue " & _submissionvalue.ToString) WriteToErrorLog("_itemcount " & _itemcount.ToString) Else WriteToErrorLog("SearchQuery returned no records") End If
I am getting the following error
<Message>An exception System.FormatException was thrown while trying to convert input value 'new_licenceid' to attribute 'account.accountid'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</Message>
*This post is locked for comments