Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Referencing Fields in QueryExpression Joins

0 views
Skip to first unread message

dow...@gmail.com

unread,
Apr 10, 2006, 8:54:13 AM4/10/06
to
I'd like to retireve a result set of contacts as well as the web url of
their associated account. The EntityName field for the QueryExpression
is set to the Contact entity. I created a join to the Account entity
using the LinkEntity class for the field AccountID.

In this scenario, is there a way using the QueryExpression to access a
field from the account entity in the result set?

Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials
service.Url =
"http://localhost:5555/mscrmservices/2006/crmservice.asmx"

Dim cols As New ColumnSet()
cols.Attributes = New String() {"fullname", "jobtitle"}

Dim link As New LinkEntity()
link.LinkFromEntityName = EntityName.contact.ToString()
link.LinkFromAttributeName = "accountid"
link.LinkToEntityName = EntityName.account.ToString()
link.LinkToAttributeName = "accountid"

Dim query As New QueryExpression()
query.EntityName = EntityName.contact.ToString()
query.ColumnSet = cols
query.LinkEntities = New LinkEntity() {link}

Dim retrieve As New RetrieveMultipleRequest()
retrieve.Query = query
Dim retrieved As RetrieveMultipleResponse =
CType(service.Execute(retrieve), RetrieveMultipleResponse)

Michael Höhne

unread,
Apr 10, 2006, 9:24:28 AM4/10/06
to
It's not possible with query expressions. You can use FetchXml or direct
SQL queries using the filtered views in the database instead.


Michael

http://www.stunnware.com/crm

----------------------------------------------------------

dow...@gmail.com

unread,
Apr 11, 2006, 2:08:42 AM4/11/06
to
Michael,

Thanks. I had gotten to the point where I thought it was not possible
but thought I'd raise the question to get confirmation.

James

0 new messages