次の方法で共有


CloneContractRequest Class

Definition

Contains the data that is needed to copy an existing contract and its line items.

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

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 instance.

/// <summary>
/// Demonstrates the CloneContract message
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="contractId">The ID of the contract to clone</param>
static void CloneContractExample(IOrganizationService service, Guid contractId)
{
      // Create the first clone of the contract.
      CloneContractRequest request = new()
      {
         ContractId = contractId,
         IncludeCanceledLines = false
      };
      var response =
         (CloneContractResponse)service.Execute(request);

      Guid clonedContractId = response.Entity.GetAttributeValue<Guid>("contractid");

      Console.WriteLine($"Cloned contract ID: {clonedContractId}");
}

For a complete sample, see Dynamics365-Apps-Samples Sample: Manage contracts

Remarks

This message requires Dynamics 365 Customer Service.

For the Web API use the CloneContract action.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have the following privileges on the Contract table and access rights on the record specified in the ContractId property. The privileges are:

  • prvReadContract
  • prvCreateContract
  • prvAppendToContact
  • prvAppendToContractTemplate
  • prvAppendContract
  • prvAppendToAccount
  • prvAppendToContact
  • prvWriteContract

Notes for Callers

By default the caller will become the owner for the new record. For this to work, the caller must have both Create and Read privileges for the contract entity. Alternatively, you can set the ownerid property to the ID of another user.

Constructors

CloneContractRequest()

Initializes a new instance of the CloneContractRequest class.

Properties

ContractId

Gets or sets the ID of the contract to be copied. Required.

ExtensionData

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

(Inherited from OrganizationRequest)
IncludeCanceledLines

Gets or sets a value that indicates whether the canceled line items of the originating contract are to be included in the copy (clone). Required.

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)
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)

Applies to

See also