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 undeleted, a list of unique application IDs is prepared related to the application reviews that were created or undeleted. Then, the Status of the most recent application review is set to In Progress or Completed based on whether the application review is completed or not, and the Review Status for the application is set to Application Review Type Name + Application Review Status When an Application Review is deleted, the number 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 the application review is completed or not, and the Review Status for the 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 for application reviews whose application review type was changed or whose completed field changed. Next, the same logic runs to change the status for the most recent application review and the review status field on the application. When an Application Review is created or updated, in addition to the above behavior, bookmarks are also cached for Application Reviews having an 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 |
