Partilhar via


UpdateEntityRequest Class

Definition

Contains the data that is needed to update the definition of a table.

public ref class UpdateEntityRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class UpdateEntityRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type UpdateEntityRequest = class
    inherit OrganizationRequest
Public NotInheritable Class UpdateEntityRequest
Inherits OrganizationRequest
Inheritance
UpdateEntityRequest
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>
/// Updates the display name of the specified table
/// </summary>
/// <param name="service">Authenticated IOrganizationService instance</param>
static void UpdateTableExample(IOrganizationService service)
{

      string tableLogicalName = "account";
      string newLabelValue = "Company";
      int languageCode = 1033; //English
      string solutionUniqueName = "SolutionName";

      RetrieveEntityRequest retrieveRequest = new()
      {
         LogicalName = tableLogicalName
      };

      var retrieveResponse = (RetrieveEntityResponse)service.Execute(retrieveRequest);

      // Just changing the Display Name in this example
      retrieveResponse.EntityMetadata.DisplayName = new Label(newLabelValue, languageCode);

      UpdateEntityRequest request = new()
      {
         Entity = retrieveResponse.EntityMetadata,
         MergeLabels = true,
         SolutionUniqueName = solutionUniqueName,
         // These options can also be updated:
         //HasActivities = true,
         //HasNotes = true,
         //HasFeedback = true
      };

      service.Execute(request);
}

Sample code on GitHub

Enable duplicate detection and retrieve duplicates

Remarks

Usage

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

Privileges and Access Rights

To perform this action, the caller must have the System administrator or System customizer security roles.

Notes for Callers

For model-driven apps, you must publish the changes before they will be visible in the application. For more information, see Publish customizations.

Constructors

UpdateEntityRequest()

Initializes a new instance of the UpdateEntityRequest class.

Properties

Entity

Gets or sets the definition of the table. Required.

ExtensionData

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

(Inherited from OrganizationRequest)
HasActivities

Gets or sets whether the entity will have a special relationship to activity tables and is a valid regarding object for the activity. Optional.

HasFeedback

Gets or sets whether the table will have a special relationship to the Feedback table. Optional.

HasNotes

Gets or sets whether the table will have a special relationship to the annotation table. Optional.

Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
MergeLabels

Gets or sets whether to merge the new labels with any existing labels. 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 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)
SolutionUniqueName

Gets or sets the unique name of the unmanaged solution that this table should be associated with. Optional.

Applies to