Rollup Message

banner art

Retrieves all the entities related to the specified entity. For example, you can use this message to retrieve all the annotations related to the specified account.

The relevant classes are specified in the following table.

Type Class
Request RollupRequest
Response RollupResponse
Target TargetRollup
Entity See below.

The following table shows the entities and target classes for this message.

Entity Target Class
activitypointer TargetRollupActivityPointerByAccount

TargetRollupActivityPointerByContact

TargetRollupActivityPointerByOpportunity

annotation TargetRollupAnnotationByAccount

TargetRollupAnnotationByContact

TargetRollupAnnotationByOpportunity

contract TargetRollupContractByAccount

TargetRollupContractByContact

incident TargetRollupIncidentByAccount

TargetRollupIncidentByContact

invoice TargetRollupInvoiceByAccount

TargetRollupInvoiceByContact

opportunity TargetRollupOpportunityByAccount

TargetRollupOpportunityByContact

quote TargetRollupQuoteByAccount

TargetRollupQuoteByContact

salesorder TargetRollupSalesOrderByAccount

TargetRollupSalesOrderByContact

Dynamic Entity TargetRollupDynamic

Remarks

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see Rollup Privileges.

Example

The following code example shows how to use the Rollup message.

[C#]
// Standard CRM Service Setup
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the column set.
ColumnSet cols = new ColumnSet();
cols.Attributes = new string [] {"name", "accountid"};

// Create the condition expression for the filter.
ConditionExpression condition = new ConditionExpression();
condition.AttributeName = "name";
condition.Operator = ConditionOperator.Like;
condition.Values = new string [] {"Opportunity 1"};

// Create the filter expression.
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] {condition};

// Create the query expression.
QueryExpression query = new QueryExpression();
query.EntityName = EntityName.opportunity.ToString();
query.ColumnSet = cols;
query.Criteria = filter;

// Create the target for the request.
TargetRollupOpportunityByAccount target = new TargetRollupOpportunityByAccount();
target.AccountId = new Guid("A0F87168-4B00-4CA2-925D-AA0A4C47B86F");
target.Query = query;

// Create the request.
RollupRequest rollup = new RollupRequest();
rollup.RollupType = RollupType.Extended;
rollup.Target = target;

// Execute the request.
RollupResponse rolledup = (RollupResponse)service.Execute(rollup);

[Visual Basic .NET]
' Standard CRM Service Setup
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the column set.
Dim cols As New ColumnSet()
cols.Attributes = New String() {"name", "accountid"}

' Create the condition expression for the filter.
Dim condition As New ConditionExpression()
condition.AttributeName = "name"
condition.Operator = ConditionOperator.Like
condition.Values = New String() {"Opportunity 1"}

' Create the filter expression.
Dim filter As New FilterExpression()
filter.FilterOperator = LogicalOperator.And
filter.Conditions = New ConditionExpression() {condition}

' Create the query expression.
Dim query As New QueryExpression()
query.EntityName = EntityName.opportunity.ToString()
query.ColumnSet = cols
query.Criteria = filter

' Create the target for the request.
Dim target As New TargetRollupOpportunityByAccount()
target.AccountId = new Guid("A0F87168-4B00-4CA2-925D-AA0A4C47B86F");
target.Query = query

' Create the request.
Dim rollup As New RollupRequest()
rollup.RollupType = RollupType.Extended
rollup.Target = target

' Execute the request.
Dim rolledup As RollupResponse = CType(service.Execute(rollup), RollupResponse)

Related Topics

CrmService Messages

© 2007 Microsoft Corporation. All rights reserved.