You are here:
Learn About Apex Triggers
A trigger is Apex code that runs before or after a specific data manipulation language (DML) event occurs, such as before the insertion or after the deletion of records in a database. Salesforce stores triggers as metadata. By modifying Salesforce custom settings, you can enable and disable Insurance Apex triggers as required by your implementation.
See Enabling and Disabling Vlocity Apex Triggers to learn how.
Trigger Details
Object |
Trigger Name |
Trigger Handler Name |
Default On/Off |
|---|---|---|---|
Account |
Party.EnablePartyModel |
Off |
|
Account.EnableTrigger |
On |
||
Attachment |
Attachment.EnableTrigger |
On |
|
CmAttachment.EnableTrigger |
On |
||
CampaignMember |
Enable.CampaignMemberActionLog |
On |
|
Contact |
Party.EnablePartyModel |
Off |
|
Contact.EnableTrigger |
On |
||
ContentVersion |
ContentVersion.EnableTrigger |
Off |
|
Contract |
Contract.EnableTrigger |
On |
|
Contract.EnableStateModel |
Off |
||
Contract.EnableUpdateDocSections |
Off |
||
Opportunity |
Opportunity.EnableTrigger |
On |
|
Order |
XOM.EnableXOMTriggers |
Off |
|
Order Item |
XOM.EnableXOMTriggers |
Off |
|
Product2 |
EPCProductTrigger |
On |
|
CpqProduct.EnableTrigger |
On |
||
XOM.EnableXOMTriggers |
Off |
||
User |
XOM.EnableXOMTriggers |
Off |
|
Cards.UserTrigger |
On |
Account
The Account trigger supports TaxId format validation and Party record creation.
How it works:
When the Account is created or updated, the trigger creates or updates the Party record if the Party.EnablePartyModel trigger handler is set to On. If the value of the Account's TaxId field is changed or populated, the trigger validates the format of the TaxId.
Attachment
The switch to control the Attachment trigger is available starting in Insurance Spring '20 release.
How it works:
On beforeUpdate and beforeInsert, if an Attachment's parent is a Product record, and the Attachment's name starts with 'TN' then set this product's ImageId__c to this attachment's Id
CmAttachment
The switch to control the CMAttachment trigger is available starting in the Insurance Spring '20 release. This trigger supports contract document links.
How it works:
After an Attachment is inserted, if the Attachment's parent is a ContractVersion__c record, the trigger creates a ContractDocumentCollection__c record.
CampaignMemberActionLog
The CampaignMember trigger supports the Campaign Call List execution.
How it works:
When a campaign member is created, deleted, or the lastCallDate is changed, the trigger creates a CampaignMemberActionLog__c record to log the change. If this trigger is off, campaign call list actions are not logged.
Contact
The Contact trigger supports TaxId format validation and Party record creation. The party record is used in:
-
Held Party Relationship: used to capture the insured party in an insurance policy, and capture dependents enrolled in plans.
-
Claim Party Relationship: used to capture claimants.
-
Opportunity referrals.
How it works:
When the Contact is created or updated, the trigger creates or updates the Party record if the Party.EnablePartyModel trigger handler is set to On. If the value of the Contact's TaxId field is changed or populated, the trigger validates the format of the TaxId.
ContentVersion
The ContentVersion trigger supports Content Profile Attributes.
How it works:
If a new version of a Content Document is created, the trigger copies the attribute assignments for the previous version to this new version.
CmContract
The Contract Type trigger supports Contract documents (the automatic creation of the first version and automatically updating sections based on the selected changes), validation of the Contract startDate, endDate and term, and enforces the Contract StateModel.
How it works (in different record states):
-
BeforeInsert: If the contractType exists in the org, populate the Contract Type field for the Contract record based on the record type/contract type configuration.
-
BeforeUpdate:
-
If RenewalNotification__c is set and the endDate is not null, the trigger updates the RenewalStartDate__c field based on RenewalNotification__c, RenewalNotificationTerm__c, and EndDate.
-
If the Contract.EnableStateModel setting is on when the Contract's Status field is updated, the triggers checks if the state transition is allowed by the State Model. If the Contract.EnableStateModel doesn't exist or is off, then the State Model is not checked.
-
If the Contract's record type is changed, and if the contractType exists in the org, then check if the contractType needs to change.
-
-
AfterInsert:
-
Create a contractVersion__c record.
-
If the contract term is null, the trigger checks if the GetContractTerm interface has been overridden. If it is not overridden, the contract term stays as null, otherwise, it can be set according to the override class.
-
-
AfterUpdate:
-
If the previous startDate is null and the new startDate is not null, the trigger updates all contract lines using the new startDate and endDate.
-
If the previous endDate is null and the new endDate is not null, then the trigger updates the RenewalStartDate__c based on RenewalNotification__c, RenewalNotificationTerm__c, and EndDate.
-
If the Contract.EnableUpdateDocSections setting is on, then the trigger updates the contract document sections of the active contractVersion__c record.
-
If this custom setting is not there or is off, this is not performed. If the contract term is null, the trigger checks if the GetContractTerm interface has been overridden. If it is not overridden, the contract term stays as null, otherwise, it can be set according to the override class.
-
Opportunity
The Opportunity trigger supports opportunity referrals.
How it works:
If an Opportunity's Referral Source (PartyId__c) is inserted or updated and the Referral Source is Contact, then the trigger creates Tasks for the Referral Source (PartyId_r.ContactId).
XOMOrderTrigger
The Order trigger supports features for Vlocity Order Management.
How it works:
-
Reset the following fields to default values: OrchestrationPlanId__c, FilfilmentStatus__c, OrchestrationPlanReferenceId__c, ThorJeopardyStatus__c and DueDate__c.
-
Propagate the Order Status to downstream Fulfilment Requests and update the FulfilmentStatus__c based on the Order Status.
-
Generate data in the RequestedCompletionDate__c field.
XOMTriggerOrderItem
How it works:
If the Order header field is empty on the Order Item object, then propagate that field based on the RequestedCompletionDate__c.
EPCProduct
The EPCProduct trigger supports the population of Global Keys and prevents the deletion of Products that have child Products.
How it works:
The trigger generates the GlobalKey and sets the Product2.GlobalKey__c. Additionally, if you attempt to delete a product, the trigger does a validation check to see if the product has a ProductChildItem record. If a ProductChildItem record exists, the parent product cannot be deleted.
CpqProduct
How it works (in different record states):
-
BeforeInsert:
-
Populate the product2.GlobalKey__c if it is empty.
-
Use SellingStartDate__c to set the EffectiveDate__c, or use the EffectiveDate__c to set the SellingStartDate__c.
-
Use SellingEndDate__c to set the EndDate__c, or use the EndDate__c to set SellingEndDate__c.
-
If you are not using SellingStartDate__c or SellingEndDate__c then this logic will not trigger.
-
-
BeforeUpdate:
-
Uses JSONAttribute__c to set isConfigurable__c. In insurance it is recommended that JSONAttribute__c is turned off because AttributeMetadata__c is used instead.
-
Additionally, sync SellingStartDate__c, SellingEndDate__c, EffectiveDate__c, and EndDate__c.
-
XOMProduct2Trigger
How it works:
The trigger generates a Global Key if one does not exist. If using Order Management Plus, it generates a Sync Delta Object record for any change made to a product.

