Solved

Microsoft CRM 3.0 .Net Query Expression help

Posted on 2009-05-05
2
824 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 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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