Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

how to retrieve n:n relationship in dynamics crm?

$
0
0
lead has n:n relationship with transactioncurrency.i'm trying to retrieve the asscoaited transactioncurrency using n:n relationship.but i'm unable to get the transactioncurrency. below is my code any references appreciated.
if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"]) is Entity)
            {
                Entity en = (Entity)context.InputParameters["Target"];
                QueryExpression qx = new QueryExpression("transactioncurrency");
                qx.ColumnSet = new ColumnSet(true);
                //LinkEntity linkEntity1 = new LinkEntity("lead", "new_lead_transactioncurrency", "leadid", "transactioncurrencyid", JoinOperator.Inner);
                //  LinkEntity linkEntity2 = new LinkEntity("new_lead_transactioncurrency", "transactioncurrency", "transactioncurrencyid", "transactioncurrency", JoinOperator.Inner);
                LinkEntity linkEntity1 = new LinkEntity("lead", "new_lead_transactioncurrency", "leadid", "leadid", JoinOperator.Inner);
                LinkEntity linkEntity2 = new LinkEntity("new_lead_transactioncurrency", "transactioncurrency", "transactioncurrencyid", "transactioncurrencyid", JoinOperator.Inner);
                linkEntity1.LinkEntities.Add(linkEntity2);
                qx.LinkEntities.Add(linkEntity1);
                EntityCollection entitycollect = service.RetrieveMultiple(qx);
                var xxx = entitycollect.Entities.Count;
            }

how to retrieve n:n relationship

hsk srinivas


Viewing all articles
Browse latest Browse all 8223

Trending Articles



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