This APEX class provides a wrapper to Promotion SObject Records. Each instance wraps an SObject Record related to the parent TPM_Promotion and provide methods to manipulate them in order to flag them for insertion or deletion. It also provides methods to extract the underlying SObject records so updates can be made.
Namespace
1cgcloud
Example Implementation
1cgcloud.TPM_Promotion tpmPromotion;23// Append the object to create a wrapper4cgcloud.TPM_Promotion.Record myRecord = tpmPromotion.append(new MyRecord__c());56// Set field values using a Map7myRecord.setField(new Map<String, Object> {8 'IsNew' => true, // The record is new9 'IsDeleted' => false, // The record is not flagged for deletion10 'MyField1__c' => 'Hello',11 'MyField2__c' => 'World!'12});1314// Extract the SObject15MyRecord__c rec = (MyRecord__c) myRecord.getRecord();1617myRecord.isNew(); // true18myRecord.isDeleted(); // false19myRecord.getId(); // A temporary SFDC Id20rec.Field1__c; // 'Hello'21rec.Field2__c; // 'World!'
Sets the fields passed in the map as fields for the wrapped SObject record. The IsNew andIsDeletedfields will map to the is New() and is Deleted() methods. If a key in the map is not an SObject field, it will be ignored.
Sets the record to be inserted as a new record or to update the existing one.
global Boolean isDeleted
Indicates if the record is flagged for deletion or if it will be updated during save.
API Version
55
Signature
global Boolean isDeleted()
global Boolean isNew
Indicates if the record is new or already exists in the database.
API Version
55
Signature
global Boolean isNew()
global Id getId
Returns the temporary id for the wrapped record. Promotion save process uses temporary id’s for records that are not still committed to the database.
API Version
55
Signature
global Id getId()
global SObject getOriginalRecord
Returns the original SObject record as stored in the database. If the record is new, this method returns null.
API Version
55
Signature
global SObject getOriginalRecord()
global SObject getRecord
Returns the wrapped SObject record. The returned record field values can be updated.
API Version
55
Signature
global SObject getRecord()
Example
1cgcloud.TPM_Promotion.Record myRecord;23// Extract the SObject4MyRecord__c rec = (MyRecord__c) myRecord.getRecord();56// Fields can be changed and they'll be saved during promotion save7rec.MyField1__c = 'Hello';8rec.MyField2__c = 'World!;
global void setFields
Sets the fields passed in the map as fields for the wrapped SObject record. The IsNew andIsDeletedfields will map to the is New() and is Deleted() methods. If a key in the map is not an SObject field, it will be ignored.
API Version
55
Signature
global void setFields(Map<String, Object> fieldValues)
Example
1cgcloud.TPM_Promotion tpmPromotion;23// Append the object to create a wrapper4cgcloud.TPM_Promotion.Record myRecord = tpmPromotion.append(new MyRecord__c());56// Set field values using a Map7myRecord.setField(new Map<String, Object> {8 'IsNew' => true, // The record is new9 'IsDeleted' => false, // The record is not flagged for deletion10 'MyField1__c' => 'Hello',11 'MyField2__c' => 'World!'12});1314// Extract the SObject15MyRecord__c rec = (MyRecord__c) myRecord.getRecord();1617myRecord.isNew(); // true18myRecord.isDeleted(); // false19myRecord.getId(); // A temporary SFDC Id20rec.Field1__c; // 'Hello'21rec.Field2__c; // 'World!'
global void setIsDeleted
Sets the record to be deleted or to update the existing one.
API Version
55
Signature
global void setIsDeleted(Boolean value)
global void setIsNew
Sets the record to be inserted as a new record or to update the existing one.