Hi,
I need to get the accounts linked to a marketing campaign through plugin ,but i dont get any result (empty entitycollection)
code is below :
QueryExpression queryContrat = new QueryExpression(); queryContrat.EntityName = "account"; queryContrat.NoLock = true; queryContrat.ColumnSet = new ColumnSet(true); var linkListAccount = new LinkEntity("account", "listmember", "accountid", "entityid", JoinOperator.LeftOuter); linkListAccount.EntityAlias = "member"; linkListAccount.Columns = new ColumnSet(true); var linkListmember = new LinkEntity("listmember", "list", "listmemberid", "listid", JoinOperator.LeftOuter); linkListmember.EntityAlias = "listmember"; linkListmember.Columns = new ColumnSet(true); var linkListcamapgne = new LinkEntity("list", "campaignitem", "listid", "entityid", JoinOperator.Inner); linkListcamapgne.EntityAlias = "list"; linkListcamapgne.Columns = new ColumnSet(true); var linkcampagnitem = new LinkEntity("campaignitem", "campaign", "entityid", "campaignid", JoinOperator.Inner); linkcampagnitem.EntityAlias = "cmitem"; linkcampagnitem.Columns = new ColumnSet(true); linkcampagnitem.LinkCriteria.AddCondition("codename", ConditionOperator.Equal, code); linkListcamapgne.LinkEntities.Add(linkcampagnitem); linkListmember.LinkEntities.Add(linkListcamapgne); linkListAccount.LinkEntities.Add(linkListmember); queryContrat.LinkEntities.Add(linkListAccount); try { EntityCollection contrats = service.RetrieveMultiple(queryContrat); if (contrats.Entities != null && contrats.Entities.Count > 0) { LogWebService.Log(ref _log, String.Format("Sortie de la fonction {0}", MethodBase.GetCurrentMethod()), LogWebService.LogLevel.Info); return contrats; } else { LogWebService.Log(ref _log, String.Format("Sortie de la fonction {0}", MethodBase.GetCurrentMethod()), LogWebService.LogLevel.Info); LogWebService.Log(ref _log, "CONTRAT_COLLECTION NULL", LogWebService.LogLevel.Info); return null; }
Thanks ,
Hi,
Please check below link:
Thanks
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,493 Most Valuable Professional
nmaenpaa 101,148