Skip to content

PROC_UpdateFields

Class · Group: Bulk DML

apex
global inherited sharing class PROC_UpdateFields implements IF_Async.Processable

Implements: 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 REPLACE, PREFIX, and SUFFIX update methods for flexible field value manipulation.

Since: 1.0

Example:

apex
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


Properties

PropertyDescription
global enum FieldUpdateMethodEnum defining methods for updating SObject fields.

Methods

MethodDescription
global IF_Queryable buildQueryable()Builds a queryable for the configured object and fields.
global void execute(List<Object> items)Executes the field update operation on the provided list of records.
global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)Constructs a field update processor with the specified parameters.

Inner Classes

ClassDescription
DTO_FieldDTO representing a field to update on an SObject.
DTO_ParametersDTO for parameters to query and update records.

Method Details

PROC_UpdateFields

apex
global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)

Constructs a field update processor with the specified parameters.

Parameters:

Since: 1.0

Example:

apex
PROC_UpdateFields.DTO_Parameters params = new PROC_UpdateFields.DTO_Parameters();
params.objectName = 'Account';
PROC_UpdateFields processor = new PROC_UpdateFields(params);

buildQueryable

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

Since: 1.0

Example:

apex
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

apex
global void execute(List<Object> items)

Executes the field update operation on the provided list of records.

Parameters:

  • items (List) - The list of SObject records to update.

Since: 1.0

Example:

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