Export (0) Print
Expand All

Assign Message

CRM 1.2
banner art

Assigns the specified entity instance to a new security principal (user). This changes the ownerid attribute of the instance.

The relevant classes are specified in the following table.

Type Class
Request AssignRequest
Response AssignResponse
Target base class TargetOwned Class
Entity See below.

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

Entity Target class
account TargetOwnedAccount
annotation TargetOwnedAnnotation
appointment TargetOwnedAppointment
campaign TargetOwnedCampaign
campaignactivity TargetOwnedCampaignActivity
campaignresponse TargetOwnedCampaignResponse
contact TargetOwnedContact
contract TargetOwnedContract
customeropportunityrole TargetOwnedCustomerOpportunityRole
customerrelationship TargetOwnedCustomerRelationship
email TargetOwnedEmail
fax TargetOwnedFax
incidentresolution TargetOwnedIncidentResolution
invoice TargetOwnedInvoice
lead TargetOwnedLead
letter TargetOwnedLetter
list TargetOwnedList
opportunity TargetOwnedOpportunity
opportunityclose TargetOwnedOpportunityClose
orderclose TargetOwnedOrderClose
phonecall TargetOwnedPhoneCall
quote TargetOwnedQuote
quoteclose TargetOwnedQuoteClose
salesorder TargetOwnedSalesOrder
serviceappointment TargetOwnedServiceAppointment
task TargetOwnedTask
template TargetOwnedTemplate
userquery TargetOwnedUserQuery
Dynamic entity TargetOwnedDynamic
User-owned custom entity TargetOwnedX where X is the name of the custom entity.

Remarks

This action applies to the parent object and associated objects that have the same owner as the parent object. Therefore, when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

See Cascading Rules for a description of how actions on a parent instance affect child instances.

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 Assign Privileges.

Note   Incidents cannot be assigned to another user with this message. Ownership of an incident can be changed using the Route message.

Example

The following code example demonstrates how to assign the specified entity instance to a new security principal (user).

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

// Create the SecurityPrincipal object.
SecurityPrincipal assignee = new SecurityPrincipal();

// Set the properties of the SecurityPrincipal object.'
// PrincipalId is a GUID that identifies the user or team 
// that will own this record.
assignee.PrincipalId = new Guid("326A0053-71CB-465E-9BEB-633E2E0851A9");

// Create the target object for the request.
TargetOwnedAccount target = new TargetOwnedAccount();

// Set the properties of the target object'.
// EntityId is a GUID that identifies the account 
// that is being assigned to the user.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Create the request object.
AssignRequest assign = new AssignRequest();

// Set the properties of the request object.'
assign.Assignee = assignee;
assign.Target = target;

// Execute the request.
AssignResponse assignResponse = (AssignResponse)service.Execute(assign);
[Visual Basic .NET]
' Set up the CRM Service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the SecurityPrincipal object.
Dim assignee As New SecurityPrincipal()

' Set the properties of the SecurityPrincipal object.'
' PrincipalId is a GUID that belongs to the user or team 
' that will own this record.
assignee.PrincipalId = new Guid("326A0053-71CB-465E-9BEB-633E2E0851A9");

' Create the target object for the request.
Dim target As New TargetOwnedAccount()

' Set the properties of the target object.'
' EntityId is some known GUID that belongs to the account that is being assigned to the user.
target.EntityId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

' Create the request object.
Dim assign As New AssignRequest()

' Set the properties of the request object.'
assign.Assignee = assignee
assign.Target = target

' Execute the request.
Dim assignResponse As AssignResponse = CType(service.Execute(assign), AssignResponse)

Related Topics

CrmService Messages

TargetOwned


© 2007 Microsoft Corporation. All rights reserved.


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft