Announcements
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
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156