Solved

Microsoft CRM 3.0 .Net Query Expression help

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 58
how to check group permission on a file located on a remote server ? 3 24
SSIS On fail action 5 38
Dynamics CRM Plugin Query TotalRecordCount returning -1 13 46
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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