CreateCustomerRelationshipsRequest Class
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
Contains the data that is needed to create a new customer lookup attribute, and optionally, to add it to a specified unmanaged solution.
For the Web API use the CreateCustomerRelationships Action .
Web API support for this message was added with December 2016 update for Microsoft Dynamics 365 (online) and December 2016 Service Pack for Microsoft Dynamics 365 (on-premises) .
Namespace: Microsoft.Xrm.Sdk.Messages
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)
Inheritance Hierarchy
System.Object
Microsoft.Xrm.Sdk.OrganizationRequest
Microsoft.Xrm.Sdk.Messages.CreateCustomerRelationshipsRequest
Syntax
[DataContractAttribute(Namespace = "https://schemas.microsoft.com/xrm/8.1/Contracts")]
public sealed class CreateCustomerRelationshipsRequest : OrganizationRequest
<DataContractAttribute(Namespace := "https://schemas.microsoft.com/xrm/8.1/Contracts")>
Public NotInheritable Class CreateCustomerRelationshipsRequest
Inherits OrganizationRequest
Constructors
Name | Description | |
---|---|---|
CreateCustomerRelationshipsRequest() | Initializes a new instance of the CreateCustomerRelationshipsRequest class. |
Properties
Name | Description | |
---|---|---|
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.) |
|
Lookup | Gets or sets the metadata for the lookup field used to store the ID of the related record. Required. |
|
OneToManyRelationships | Gets or sets the metadata array for the one-to-many relationships to the Account and Contact entity. Required. |
|
Parameters | Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.) |
|
RequestId | Gets or sets the ID of an asynchronous operation (system job). Optional. (Inherited from OrganizationRequest.) |
|
RequestName | Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.) |
|
SolutionUniqueName | Gets or sets the name of the unmanaged solution to which you want to add this customer lookup attribute to. Optional. |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
Remarks
Message Availability
For this message to work, the caller must be connected to the server.
Usage
Pass an instance of this class to the Execute method, which returns an instance of the CreateCustomerRelationshipsResponse class.
Privileges and Access Rights
To perform this action, the caller must have the required privileges, as listed in CreateCustomerRelationships message privileges.
Notes for Callers
Use the CreateCustomerRelationshipsRequest message to create two entity relationships to the lookup attribute: one to the Account entity and the other one to the Contact entity. You cannot add relationship to any other entity except for Account and Contact entities.
Supported Entities
You can only add attributes to customizable entities where the managed property CanCreateAttributes is true.
Examples
The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.
CreateCustomerRelationshipsRequest createCustomerReq = new CreateCustomerRelationshipsRequest
{
Lookup = new LookupAttributeMetadata
{
Description = new Label("The owner of the bank account", 1033),
DisplayName = new Label("Account owner", 1033),
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.ApplicationRequired),
SchemaName = "new_customerid"
},
OneToManyRelationships = new OneToManyRelationshipMetadata[]
{
new OneToManyRelationshipMetadata()
{
ReferencedEntity = "account",
ReferencingEntity = _customEntityName,
SchemaName = "new_bankaccount_customer_account",
},
new OneToManyRelationshipMetadata()
{
ReferencedEntity = "contact",
ReferencingEntity = _customEntityName,
SchemaName = "new_bankaccount_customer_contact",
}
},
};
_serviceProxy.Execute(createCustomerReq);
Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Microsoft.Xrm.Sdk.Messages Namespace
Create a customer lookup attribute
Sample: Create and update entity metadata
Return to top
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright