?
Solved

Microsoft CRM 3.0 .Net Query Expression help

Posted on 2009-05-05
2
Medium Priority
?
833 Views
Last Modified: 2013-11-07
Hi there,
I am developing a CRM 3.0 Callout in VB.net that uses a service.retrievemultiple statement that will retrieve the list of CRM 3.0 system users who own the contacts that a marketing campaign email or letter has been sent to.

I am after some assistance with the query expression, I have created what i think is the correct Advanced Find in the CRM interface as a sanity check that the general concept works but translating this into the query expression has me a little lost.

The Advanced find for the query would be as follows:
Look For: Users
Contacts (owners)
     Activity Parties(party)
             Activity(E-Mail)
                     Subject   Equals    XXXXX(Search Term)XXXXX

Is there anyone who knows enough to translate this search into a retirevemultiple query or could point me in the right direction?

Alistair
0
Comment
Question by:r0t0rua
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
rakeshAgarwal earned 2000 total points
ID: 24311488
Hi

 You have to use concept of link entity  here. I am pasting code snippet from one of  SDK codes provided by microsoft


                        // Create the ConditionExpression.
                        ConditionExpression condition = new ConditionExpression();

                        // Set the condition for the retrieval to be when the last name of the account's owner is not Cannon.
                        condition.AttributeName = "partyid";
                        condition.Operator = ConditionOperator.Equal;
                        condition.Values = new string [] {user.UserId.ToString()};

                        // Build the filter based on the condition.
                        FilterExpression filter = new FilterExpression();
                        filter.FilterOperator = LogicalOperator.And;
                        filter.Conditions = new ConditionExpression[] {condition};

LinkEntity link = new LinkEntity();

                        // Set the properties of the LinkEntity.
                        link.LinkCriteria = filter;

                        // Set the linking entity to be the activity.
                        link.LinkFromEntityName = EntityName.activitypointer.ToString();

                        // Set the attribute being linked to to be the activityid.
                        link.LinkFromAttributeName = "activityid";

                        // Set the entity being linked to to be the activityparty.
                        link.LinkToEntityName = EntityName.activityparty.ToString();
                  
                        // Set the attribute linking to the activityparty to be the activityid.
                        link.LinkToAttributeName = "activityid";
                  
                        // Create the query.
                        QueryExpression query = new QueryExpression();

                        // Set the properties of the query.
                        query.EntityName = EntityName.activitypointer.ToString();
                        query.ColumnSet = new AllColumns();
                        query.LinkEntities = new LinkEntity[] {link};


 I think there is a tool in stunnware.com.

regards
Rakesh Agarwal  

0
 

Author Comment

by:r0t0rua
ID: 24312701
Thanks for the SDK snippet, I already had the sample code as my base.  The real gem you supplied was the www.stunnware.com link which lead me to the FetchXML tool he has developed that generates the .Net query from a very easy to use GUI

http://www.stunnware.com/crm2/topic.aspx?id=FindingData6
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question