Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Query Expression from Phonecall to Contact

$
0
0

I've been trying for a bit now to get a way to link a phonecall to a contact within a Query Expression. I don't think I'm doing my Link Entities correctly.

Here is my query expression.  Where am I going wrong?

using Microsoft.Crm.Sdk.Messages.Samples;
using Microsoft.Xrm.Sdk.Query.Samples;

QueryExpression qExpression = new QueryExpression("phonecall")
            {
                ColumnSet = cs,
                LinkEntities =
                {
                   
                    new LinkEntity()//"phonecall", "activity", "activityid", "activityid", JoinOperator.Inner)
                    {
                        EntityAlias = "ap",
                        LinkFromEntityName= "phonecall",
                        LinkFromAttributeName = "activityid",
                        LinkToEntityName = "activitypointer",
                        LinkToAttributeName = "activityid",
                        JoinOperator = JoinOperator.Inner
                    },
                    new LinkEntity()//"phonecall", "activity", "activityid", "activityid", JoinOperator.Inner)
                    {
                        EntityAlias = "app",
                        LinkFromEntityName= "activitypointer",
                        LinkFromAttributeName = "activityid",
                        LinkToEntityName = "activityparty",
                        LinkToAttributeName = "activityid",
                        JoinOperator = JoinOperator.Inner,
                        LinkCriteria = new FilterExpression
                         {
                             Conditions =
                             {
                                 new ConditionExpression("ParticipationTypeMask", ConditionOperator.Equal, 2),                          
                             }
                         }
                    },
                    new LinkEntity()
                    {
                        EntityAlias = "con",
                        Columns = new ColumnSet("fullname","contactid"),
                        JoinOperator = JoinOperator.Inner,
                        LinkFromEntityName = "activityparty",
                        LinkFromAttributeName = "partyid",
                        LinkToEntityName = "contact",
                        LinkToAttributeName = "contactid"
                    }
                }
            };


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>