UpdateRequest Class

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

Contains the data that is needed to update an existing record.

Namespace: Microsoft.Xrm.Sdk.Messages
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

'Declaration
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/xrm/2011/Contracts")> _
Public NotInheritable Class UpdateRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/xrm/2011/Contracts")] 
public sealed class UpdateRequest : OrganizationRequest

Example

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.


// Retrieve current price list
ProductPriceLevel priceListItem =
    (ProductPriceLevel)_serviceProxy.Retrieve(
        ProductPriceLevel.EntityLogicalName,
        _priceListItemId,
        new ColumnSet("productpricelevelid", "amount")
    );

Console.WriteLine("Current price list retrieved.");
Console.WriteLine();

Console.WriteLine("Details before update:");
Console.WriteLine("----------------");
Console.WriteLine("Current order total: {0}",
    salesOrder.TotalAmount.Value);
Console.WriteLine("Current price per item: {0}",
    priceListItem.Amount.Value);
Console.WriteLine("</End of Listing>");
Console.WriteLine();

// Update the price list
priceListItem.Amount = new Money(30.0M);

UpdateRequest updatePriceListItem = new UpdateRequest()
{
    Target = priceListItem,
};
_serviceProxy.Execute(updatePriceListItem);

Console.WriteLine("Price list updated.");

                 ' Retrieve current price list
                 Dim priceListItem As ProductPriceLevel =
CType(_serviceProxy.Retrieve(ProductPriceLevel.EntityLogicalName,
        _priceListItemId,
        New ColumnSet("productpricelevelid", "amount")), 
    ProductPriceLevel)

                 Console.WriteLine("Current price list retrieved.")
                 Console.WriteLine()

                 Console.WriteLine("Details before update:")
                 Console.WriteLine("----------------")
                 Console.WriteLine("Current order total: {0}", salesOrder.TotalAmount.Value)
                 Console.WriteLine("Current price per item: {0}", priceListItem.Amount.Value)
                 Console.WriteLine("</End of Listing>")
                 Console.WriteLine()

                 ' Update the price list
                 priceListItem.Amount = New Money(30D)

                 Dim updatePriceListItem As New UpdateRequest() With
                     {
                         .Target = priceListItem
                     }
                 _serviceProxy.Execute(updatePriceListItem)

                 Console.WriteLine("Price list updated.")

Remarks

Message Availability

This message works regardless whether the caller is connected to the server or offline. Not all entity types support this message offline. For more information, see Supported Entities later in this topic.

Usage

Pass an instance of this class to the Execute method, which returns an instance of the UpdateResponse class.

This message supports one or more optional parameters. For more information, see Pass Optional Parameters in Messages.

Privileges and Access Rights

To perform this action, the caller must have privileges on the specified entity in the entity parameter. For a list of the required privileges, see Update Privileges.

Notes for Callers

This message updates a record and its related records in one transaction. For a less complex method that updates a single record, use the Update method.

If the entity instance that is specified in the Target parameter includes attributes that are not valid for update, they are ignored.

Supported Entities

You can use this method to update any record of an entity that supports the Update message, including custom entities.

The following table shows the default entities that support this message. For the listed entities of this message, the Availability column shows Server if the caller must be connected to the server and shows Both if the caller can be either connected to, or disconnected from, the server.

Entity Availability

account

Both

activitymimeattachment

Both

annotation

Both

annualfiscalcalendar

Both

appointment

Both

asyncoperation

Both

businessunit

Server

businessunitnewsarticle

Both

calendar

Both

campaign

Both

campaignactivity

Both

campaignresponse

Both

competitor

Both

connection

Both

connectionrole

Both

constraintbasedgroup

Both

contact

Both

contract

Both

contractdetail

Both

contracttemplate

Server

customeraddress

Both

customeropportunityrole

Both

customerrelationship

Both

discount

Both

discounttype

Both

displaystring

Server

duplicaterule

Server

duplicaterulecondition

Server

email

Both

emailserverprofile

Server

equipment

Server

fax

Both

fieldpermission

Server

fieldsecurityprofile

Server

fixedmonthlyfiscalcalendar

Both

goal

Server

goalrollupquery

Server

import

Both

importfile

Both

importjob

Server

importmap

Both

incident

Both

incidentresolution

Both

invoice

Both

invoicedetail

Both

isvconfig

Server

kbarticle

Both

kbarticlecomment

Both

kbarticletemplate

Both

lead

Both

letter

Both

list

Both

mailbox

Server

mailmergetemplate

Both

metric

Server

monthlyfiscalcalendar

Both

msdyn_postalbum

Server

msdyn_postconfig

Server

msdyn_postruleconfig

Server

opportunity

Both

opportunityclose

Both

opportunityproduct

Both

orderclose

Both

organization

Server

organizationui

Server

phonecall

Both

pluginassembly

Server

plugintype

Server

pricelevel

Both

principalobjectattributeaccess

Server

processsession

Both

product

Both

productpricelevel

Both

publisher

Server

publisheraddress

Server

quarterlyfiscalcalendar

Both

queue

Server

queueitem

Both

quote

Both

quoteclose

Both

quotedetail

Both

recurrencerule

Server

recurringappointmentmaster

Both

relationshiprole

Both

relationshiprolemap

Both

report

Server

reportcategory

Server

reportentity

Server

reportvisibility

Server

resourcespec

Both

role

Server

rollupfield

Server

salesliterature

Both

salesliteratureitem

Both

salesorder

Both

salesorderdetail

Both

savedquery

Server

savedqueryvisualization

Server

sdkmessageprocessingstep

Server

sdkmessageprocessingstepimage

Server

sdkmessageprocessingstepsecureconfig

Server

semiannualfiscalcalendar

Both

service

Server

serviceappointment

Both

serviceendpoint

Server

sharepointdocumentlocation

Server

sharepointsite

Server

site

Server

sitemap

Server

solution

Server

subject

Both

systemform

Server

systemuser

Server

task

Both

team

Server

template

Both

territory

Server

transactioncurrency

Server

uom

Both

uomschedule

Both

userentityinstancedata

Both

userentityuisettings

Both

userform

Server

userquery

Both

userqueryvisualization

Both

usersettings

Both

webresource

Server

workflow

Server

workflowdependency

Server

workflowlog

Server

Inheritance Hierarchy

System.Object
   Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Xrm.Sdk.Messages.UpdateRequest

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.

Platforms

Development Platforms

Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)

Target Platforms

Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),

Change History

See Also

Reference

UpdateRequest Members
Microsoft.Xrm.Sdk.Messages Namespace

Other Resources

Write Code for Microsoft Dynamics CRM (Web Services)
Sample: Process Quotes, Sales Orders and Invoices

Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.