简体   繁体   中英

CRM 2013: RollupRequest activitypointer

I am trying to get all the activities related to an opportunity record in Dynamics CRM 2013. I've tried using the RollupRequest, but I am getting an error that the activitypointer is not a supported rollup entity. But if I try the same code using an account instead of an opportunity CRM does not complaint.
I want to avoid using multiple queries to retrieve the activities in order to use the paging feature of query set or fetchxml.

Below is the testing code I used. According to Microsoft the combination is not one of the supported ones: http://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.rolluprequest.aspx

// Create QueryExpression
var query = new QueryExpression() {
    EntityName = "activitypointer",
    ColumnSet = new ColumnSet(true)
};


// Create RollupRequest
RollupRequest rollupRequest = new RollupRequest();
rollupRequest.Query = query;
rollupRequest.Target = new EntityReference("opportunity", new Guid("1d317b15-dbe0-e311-b505-0050569d9a3e"));
rollupRequest.RollupType = RollupType.Extended;
Console.WriteLine("Created RollupRequest.");

// Execute RollupRequest
RollupResponse rollupResponse = (RollupResponse)_serviceProxy.Execute(rollupRequest);
Console.WriteLine("Executed RollupRequest.");

I think you can make your code work by setting:

rollupRequest.RollupType = RollupType.None;

I will still retrieve all activitypointers directly related to the opportunity.

According to the RollupType Enumeration page, Extended and Related rollup types gives deeper level of roll up, that probably was not implemented for opportunity due to performance reasons (just guess). Since opportunity related to the account or contact (and all activities related to them should be in rollup), account and contacts might have another opportunities, these opportunities also has a product, it linked to the lead, at it in it's turn related to either account or contact and so on and so on...

It's also possible, that Microsoft just don't want to rollup combinations of entities that might lead to recursion, for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM