PROC_UpdateFields
Class · Group: Bulk DML
global inherited sharing class PROC_UpdateFields implements IF_Async.ProcessableImplements: IF_Async.Processable
Known Derived Types: IF_Async.Processable.execute(List<Object>)
Processor for bulk field updates using the adaptive async framework. Implements IF_Async.Processable to enable automatic selection between Queueable and Batch execution. Supports the REPLACE, PREFIX, SUFFIX and COPY_FROM_FIELD update methods for flexible field value manipulation.
Example
PROC_UpdateFields.DTO_Parameters params = new PROC_UpdateFields.DTO_Parameters();
params.objectName = 'Account';
PROC_UpdateFields.DTO_Field field = new PROC_UpdateFields.DTO_Field();
field.name = 'Description';
field.value = 'Updated via bulk processor';
params.updateFields.add(field);
PROC_UpdateFields processor = new PROC_UpdateFields(params);See Also: IF_Async.Processable, UTIL_AsynchronousJobLauncher
Methods
| Method | Description |
|---|---|
| global IF_Queryable buildQueryable() | Builds a queryable for the configured object and fields. |
| global void execute(List<Object> items) | Applies the field updates to the given records and saves them. |
buildQueryable
global IF_Queryable buildQueryable()Builds a queryable for the configured object and fields.
Returns IF_Queryable — An IF_Queryable instance for retrieving records to update.
Example
PROC_UpdateFields.DTO_Parameters params = new PROC_UpdateFields.DTO_Parameters();
params.objectName = 'Account';
PROC_UpdateFields.DTO_Field field = new PROC_UpdateFields.DTO_Field();
field.name = 'Name';
params.updateFields.add(field);
IF_Queryable query = new PROC_UpdateFields(params).buildQueryable();execute
global void execute(List<Object> items)Applies the field updates to the given records and saves them. All updates are applied to each record first, so two updates of one field build on each other. Then only the record's Id and the fields in the update list are saved. Other fields on the record, such as the field a copy reads from, are not saved.
Because the save does not hold the field a copy reads from, the save does not check whether the user may read that field. The read that found the records decides it. If the user's access to that field must count, read the records with the user's access (user mode), as buildQueryable does by default.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | List | The list of SObject records to update. |
Example
PROC_UpdateFields.DTO_Parameters params = new PROC_UpdateFields.DTO_Parameters();
PROC_UpdateFields.DTO_Field field = new PROC_UpdateFields.DTO_Field();
field.name = 'Name';
field.value = 'Updated';
params.updateFields.add(field);
List<Account> accounts = [SELECT Id, Name FROM Account LIMIT 100];
new PROC_UpdateFields(params).execute(accounts);Constructors
| Constructor | Description |
|---|---|
| global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters) | Constructs a field update processor with the specified parameters. |
PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)
global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)Constructs a field update processor with the specified parameters.
Parameters
| Parameter | Type | Description |
|---|---|---|
parameters | PROC_UpdateFields.DTO_Parameters | The parameters defining which fields to update and how. |
Example
PROC_UpdateFields.DTO_Parameters params = new PROC_UpdateFields.DTO_Parameters();
params.objectName = 'Account';
PROC_UpdateFields processor = new PROC_UpdateFields(params);Inner Classes
| Class | Description |
|---|---|
| DTO_Field | DTO representing a field to update on an SObject. |
| DTO_Parameters | DTO for parameters to query and update records. |
| FieldUpdateMethod | Enum defining methods for updating SObject fields. |