Hello.
In CRM 2016 on account is a view with all activities and related records fields "regarding".
How to get this list in SQL or C#:
This code return only 7 records. How get all 42 records?
QueryExpression query = new QueryExpression { EntityName = "activitypointer", ColumnSet = new ColumnSet(new string[] { "activitytypecode" }) }; query.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, Guid.Parse("35D2EE25-BE37-E211-AA69-00155D644201")); EntityCollection collection = service.RetrieveMultiple(query);
*This post is locked for comments
This is it, but I added a condition on "is regular activity" and I have exactly what I needed. Thank you very much :)
Criteria = { FilterOperator = LogicalOperator.And, Conditions = { new ConditionExpression("isregularactivity", ConditionOperator.Equal, true) } }
Then try RollupRequest - I believe this is what you're looking for:
var rollupRequest = new RollupRequest() { RollupType = RollupType.Extended, Query = new QueryExpression { EntityName = "activitypointer", ColumnSet = new ColumnSet(new string[] { "activitytypecode" }) }, Target = new EntityReference("account", Guid.Parse("35D2EE25-BE37-E211-AA69-00155D644201")) }; var rollupResonse = (RollupResponse)service.Execute(rollupRequest); var records = rollupResonse.EntityCollection.Entities;
Unfortunately, this command only returned 12 records.
Hello,
Try to use following code:
QueryExpression query = new QueryExpression { EntityName = "activitypointer", ColumnSet = new ColumnSet(new string[] { "activitytypecode" }), Distinct = true }; var link = query.AddLink("activityparty", "activityid", "activityid"); link.LinkCriteria.AddCondition("partyid", ConditionOperator.Equal, Guid.Parse("35D2EE25-BE37-E211-AA69-00155D644201")); EntityCollection collection = service.RetrieveMultiple(query);
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... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156