Muokkaa

Jaa


UpdateMultiple Operation

Updates a set of records. The updated array of records is passed as a reference and is updated with the latest version.

Note

The UpdateMultiple operation attempts to update one field at a time. This can cause errors if the updated value in one field prevents another field's value from being valid. You can resolve this by deleting and inserting lines instead of updating fields.

Method Signature

void UpdateMultiple(ref Entity[] entity)

Parameters

Parameter Description
entity[] Type: An array of Entities.

An array of a specific object type that represents the page.

Results

Result name Description
entity[] Type: An array of Entities

An array of a specific object type that represents the page. Contains the latest values that are present on the page after the records have been updated by the business logic or another concurrent process.

Faults

SOAP fault message Description
Other user has modified [record name]. Indicates that another user or process has modified the record after it has been retrieved for this update operation.
[record name] [field] [value] does not exist. Indicates that the record has been deleted by another user or process after it has been retrieved for this update operation.
The [record name] already exists. Identification fields and values: [field]=[value] Indicates that the renaming of the record would violate key constraints.

Other faults are possible if they are generated by the AL code.

The UpdateMultiple operation is executed as a single transaction unless the AL code explicitly commits the transaction. Either all or none of the records are updated provided that the application code does not explicitly call COMMIT.

Usage Example

The following example adds the string "Updated" to the name of the first 100 customer names that start with S.

List<Customer_Filter> filterArray = new List<Customer_Filter>();  
Customer_Filter nameFilter = new Customer_Filter();  
nameFilter.Field = Customer_Fields.Name;  
nameFilter.Criteria = "S*";  
filterArray.Add(nameFilter);  
Customer[] custList = service.ReadMultiple(filterArray.ToArray(), null, 100);  
for (int i = 0; i < custList.Length; i++)  
{  
  custList [i].Name = custList [i].Name + " Updated";  
}  
service.Update(ref custList)   

Basic Page Operations