This documentation is archived and is not being maintained.

Rollup Message (CrmService)

Dynamics
banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment typesWorks online and offline

Retrieves all the entity instances related to the specified entity instance. 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.

TypeClass
RequestRollupRequest
ResponseRollupResponse
TargetTargetRollup
EntitySee the following table.

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

EntityTarget Class
activitypointerTargetRollupActivityPointerByAccount

TargetRollupActivityPointerByContact

TargetRollupActivityPointerByOpportunity

annotationTargetRollupAnnotationByAccount

TargetRollupAnnotationByContact

TargetRollupAnnotationByOpportunity

contractTargetRollupContractByAccount

TargetRollupContractByContact

incidentTargetRollupIncidentByAccount

TargetRollupIncidentByContact

invoiceTargetRollupInvoiceByAccount

TargetRollupInvoiceByContact

opportunityTargetRollupOpportunityByAccount

TargetRollupOpportunityByContact

quoteTargetRollupQuoteByAccount

TargetRollupQuoteByContact

salesorderTargetRollupSalesOrderByAccount

TargetRollupSalesOrderByContact

DynamicEntityTargetRollupDynamic

Remarks

To use this message, pass an instance of the RollupRequest class as the request parameter in the Execute method.

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#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

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

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

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

// Create the QueryExpression.
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]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle"
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx"
service.CrmAuthenticationTokenValue = token
service.Credentials = System.Net.CredentialCache.DefaultCredentials

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

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

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

' Create the QueryExpression.
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)

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show: