Application Review Triggers
A Trigger is a section of code executed before or after inserting or modifying a Salesforce record based on a condition provided. There are different types of triggers based on the actions to be performed. Listed below are the triggers available in the Application Review package:
ApplicationReviewTrigger
Trigger/Class | ApplicationReviewTrigger |
Object | Application_Review__c |
Type | After insert, after update, after delete, after undelete |
Description | Depending on on the Type of update (insert, update, delete or undelete), the Application Review record is updated to reflect the appropriate status. |
Affects | Application_Review__c |
How affected | When an Application Review is created or un-deleted a list of unique application ids is prepared related to application reviews which were created or undelete. Then, the Status of the most recent application review is set to In Progress or Completed based on whether application review is completed or not and the Review Status for application is set to Application Review Type Name + Application Review Status When an Application Review is deleted the of unique application ids is prepared related to the application reviews being deleted. The most recent (by CreatedDate) application review is found for each application and its status is set to In Progress or Completed based on whether application review is completed or not and the Review Status for application is set to Application Review Type Name + Application Review Status When an Application Review is updated a list of unique application ids is prepared which are related to application reviews whose related application review type was changed or there was change in completed field. Next, the same logic runs to change status for most recent application review and review status field on application. When an Application Review is created or updated, In addition to the above behavior, bookmarks are also cached for Application Reviews having Application Review Type with iPad Configuration. However, bookmarks caching requests are only submitted when application reviews weren’t created or updated via a batch job. |
Criteria | See above |
Custom Setting | N/A |
Custom Setting Description | N/A |
Package Version | 1.0 - current |
Below are common errors that are encountered with the ApplicationReviewTrigger along with a resolution:
NullPointerException in TargetX_Reader.ApplicationReviewTrigger
Resolution: This error is typically due to the Test application record not having a Record Type.
ApplicationReviewTriggerHandler
Trigger/Class | ApplicationReviewTriggerHandler Class |
Object | TargetX_Reader__Application_Review__c |
Type | after insert, after update |
Description |
Sets the App Review Completed Date to today when the application review is marked complete. |
Criteria | Completed is changed to “True” and App Review Completed Date is null. |
Custom Setting | Set App Review Completed Date |
Custom Setting Description | Once enabled and an Application Review is completed, the Date Completed field is set to the current date and time. The trigger only updates Null values so existing data is not overwritten. |
Package Version | Decision 2305.4 - present |