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.

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


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.

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.

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

ParameterTypeDescription
itemsListThe list of SObject records to update.

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

Constructors

ConstructorDescription
global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)Constructs a field update processor with the specified parameters.

PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)

apex
global PROC_UpdateFields(PROC_UpdateFields.DTO_Parameters parameters)

Constructs a field update processor with the specified parameters.

Parameters

ParameterTypeDescription
parametersPROC_UpdateFields.DTO_ParametersThe parameters defining which fields to update and how.

Example

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

Inner Classes

ClassDescription
DTO_FieldDTO representing a field to update on an SObject.
DTO_ParametersDTO for parameters to query and update records.
FieldUpdateMethodEnum defining methods for updating SObject fields.