[Gelöst] CrmSdk Abfragen

31. März 2010 16:56

Hallo zusammen,

ich mache gerade ein kleines VB Tool und frage die Entität Account ab.
Mache ich es nur über Feld "name" so funktioniert es wunderbar.
Versuche ich aber zwei Felder zu verbinden bzw. nach "name" und "new_parentagentid" zu suchen, bekomme ich einen Fehler.

Jmd eine Idee?
Danke


Code:
Private Sub Search()
        Dim cols As New ColumnSet()
        cols.Attributes = New String() {"name", "accountid", "accountnumber"}

        Dim condition As ConditionExpression = New ConditionExpression()
        condition.AttributeName = "name"
        condition.Operator = ConditionOperator.[Like]
        condition.Values = New Object() {tbSuche.Text & "%"}


        Dim condition2 As ConditionExpression = New ConditionExpression()
        condition2.AttributeName = "new_parentagentid"
        condition2.Operator = ConditionOperator.[Like]
        condition2.Values = New Object() {vertreterId = New Guid("{" + vertreterString + "}")}

        Dim filter As New FilterExpression()
        filter.FilterOperator = LogicalOperator.And
        filter.Conditions = New ConditionExpression() {condition, condition2}

        Dim query As New QueryExpression()
        query.EntityName = EntityName.account.ToString()
        query.ColumnSet = cols
        query.Criteria = filter

        ListView.Items.Clear()
        Dim account As BusinessEntityCollection = service.RetrieveMultiple(query)
        Dim int As Integer = 0
        For Each be As BusinessEntity In account.BusinessEntities
            Dim ppl As account = CType(be, account)
            ListView.Items.Add(ppl.name)
            ListView.Items(int).SubItems.Add(ppl.accountnumber)
            ListView.Items(int).SubItems.Add(ppl.accountid.Value.ToString)
            int = int + 1
        Next
        int = 0
    End Sub

Re: CrmSdk Abfragen

1. April 2010 11:20

[Beitrag aus dem Forum AX 4.xx nach CRM 4.xx verschoben]

Gruß, Axel Kühn
MSDynamics.de-Team

Re: CrmSdk Abfragen

1. April 2010 11:26

Beitrag bereits durch Beitrag [gelöst] CrmSdk VB.Net beantwortet.
Gruß, Axel Kühn
MSDynamics.de-Team