Compartir a través de


RollupRequest Class

Definition

Contains the data that is needed to retrieve all the entity records that are related to the specified record.

public ref class RollupRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class RollupRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type RollupRequest = class
    inherit OrganizationRequest
Public NotInheritable Class RollupRequest
Inherits OrganizationRequest
Inheritance
RollupRequest
Attributes

Examples

The following example shows how to use this message. For this sample to work correctly, you must have an authenticated connection to the server with a client that implements the IOrganizationService interface instance.

/// <summary>
/// Retrieve all the activities related to an account 
/// or annotations, contracts, incidents, invoices, 
/// opportuntities, quotes, or salesorders related to the account
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
/// <param name="account">A reference to the account record</param>
static void RollupAccountActivities(IOrganizationService service, EntityReference account)
{
    var request = new RollupRequest
    {
        Query = new QueryExpression("activitypointer")
        {
            ColumnSet = new ColumnSet("activitytypecode", "subject", "regardingobjectid")
        },
        Target = account,
        RollupType = RollupType.Extended
    };

    var response = (RollupResponse)service.Execute(request);

    Console.WriteLine($"Count: {response.EntityCollection.Entities.Count}\n");

    foreach (Entity activity in response.EntityCollection.Entities)
    {
        Console.WriteLine($"Type: {activity["activitytypecode"]} Subject:{activity["subject"]}");
        Console.WriteLine($"\tRelated to: {activity.FormattedValues["regardingobjectid"]}\n");
    }
}

Example Output:

Count: 2

Type: task Subject:Example task
        Related to: Contoso Pharmaceuticals (sample)

Type: task Subject:Task on Opportunity
        Related to: They sell many of the same items that we do - need to follow up (sample)

Remarks

For the Web API use the Rollup function.

A rollup operation retrieves all annotations that are related to a specified account. An annotation is a note that is attached to one or more objects, including other notes.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the RollupResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges on the specified entities in the TargetQuery properties. The caller must also have access rights on the specified record in the Target property and read access rights on the records that are returned from the query.

Notes for Callers

The target entities include: account, contact, and opportunity. The rollup type (RollupType) for the supported entities depends on the target entity type.

Rollup Types

The following table lists the available rollup types for each supported entity depending on the target of the rollup operation.

Supported entityTarget entityRollup type
activitypointeraccount or contactRelated, Extended
activitypointeropportunityopportunity
annotationaccount or contactRelated, Extended, None
annotationopportunityRelated, Extended, None
contractaccount or contactRelated, Extended
incidentaccount or contactRelated
invoiceaccount or contactRelated, Extended
opportunityaccount or contactRelated, Extended
quoteaccount or contactRelated, Extended
salesorderaccount or contactRelated, Extended

Constructors

RollupRequest()

Initializes a new instance of the RollupRequest class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
Query

Gets or sets the query criteria for the rollup operation. Required.

RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
RollupType

Gets or sets the rollup type. Required.

Target

Gets or sets the target record for the rollup operation. Required.

Applies to

See also