CRM2016 On Premises
Firstly thank you for all the help on this linked query.
I am trying to get the new_licenceid value to a string ( to pass through to a workflow ) . New_licenceid is a 1:N relationship from accounts .
I have tried several different ways to get the id but all get is Conversion from type 'EntityReference' to type 'String' is not valid.
help
Dim SearchQuery As QueryExpression = New QueryExpression("new_transactionsets") SearchQuery.ColumnSet = New ColumnSet("new_transactionsetsid", "new_licenceid") SearchQuery.Criteria.FilterOperator = LogicalOperator.And SearchQuery.Criteria.AddCondition("new_fileserial", ConditionOperator.EndsWith, _str_serialnumber) SearchQuery.Criteria.AddCondition("new_creditdebitdate", ConditionOperator.Equal, _clearedfundsdate) SearchQuery.Criteria.AddCondition("new_transactioncount", ConditionOperator.Equal, _fileCount) SearchQuery.Criteria.AddCondition("new_submissionvalue", ConditionOperator.Equal, _fileTotal) Dim linkEntityB As LinkEntity = New LinkEntity() With { .LinkFromEntityName = "new_transactionsets", .LinkFromAttributeName = "new_originatingaccount", .LinkToEntityName = "new_originatingaccounts", .LinkToAttributeName = "new_originatingaccountsid", .JoinOperator = JoinOperator.LeftOuter, .Columns = New ColumnSet("new_sun"), .EntityAlias = "B"} linkEntityB.LinkCriteria.AddCondition("new_sun", ConditionOperator.Equal, _sun) Dim TransactionSetCollection As EntityCollection = service.RetrieveMultiple(SearchQuery) If TransactionSetCollection.Entities.Count > 0 Then For Each _tset In TransactionSetCollection.Entities Using sw As StreamWriter = File.AppendText(Globals.clsGlobals.LogFile & "importer.txt") sw.WriteLine("TEST new_licenceid " & CType(_tset.Attributes("new_licenceid"), String)) End Using Next End If
*This post is locked for comments