Recruitment Manager 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 TargetX Recruitment Manager package:
ApplicationInsertTrigger
| Trigger/Class | ApplicationInsertTrigger |
|---|---|
| Object | Application |
| Type | After insert, after update |
| Description | Updates related Contact’s Status to “Applicant” according to Set Applicant Status field in SRM Preferences custom setting. Excludes Contacts with statuses defined in Excluded Student Status field in SRM Preferences custom setting. |
| Affects | Contact.TargetX_SRMb__Status__c |
| How affected | Contact Status updated to “Applicant” |
| Criteria | Application is inserted or updated AND Set Applicant Status = ‘1’ or ‘2’ AND Contact Status is not in Excluded Student Status list. |
| Custom Setting | TargetX_SRMb__SRM_Preferences__c Field Name: Applicant Status, Excluded Student Statuses Field API Name: Set_Applicant_Status__c,Excluded_Student_Statuses__c |
| Custom Setting Description | Set_Applicant_Status__c = 1 causes the trigger to update Contact status when Application is created. Set_Applicant_Status__c = 2 causes the trigger to update Contact status only when Application Stage = “Submitted.” Excluded_Student_Statuses__c is a comma delimited list of Contact Status values that should be ignored by this trigger, thereby preventing the Contact Status field from being updated/overwritten. |
| Package Version | 2.0 - Current |
Below are common errors that are encountered with the ApplicationInsertTrigger along with a resolution:
Message: TargetX_SRMb.ApplicationInsertTrigger: System.LimitException: Apex CPU time limit exceeded Status code: 18
Resolution: Adjust your Application Tracker Custom Settings to run @future. This means that the process to evaluate for checklist items will wait a minute or so after the record has been updated. You can also set the Batch size for @future to 5.
Apex trigger Touchpointsb.TaskRollup caused an unexpected exception, contact your administrator: Touchpointsb.TaskRollup: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 0036100000YvmvlAAB; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []: (Touchpointsb)
Resolution: User must have CREATE access on the Contact object.
ApplicationTrigger
| Trigger/Class | ApplicationTrigger |
|---|---|
| Object | Application |
| Type | before insert, before update, before delete, after insert, after update, after delete, after undelete |
| Description | Runs Contact Application Roll-Up function to populate Contact fields defined in the Source to Master Fields object after an Application is inserted, updated, or deleted. |
| Affects | Contact, TargetX_SRMb__Application__c, TargetX_SRMb__Checklist_Item__c |
| How affected | Updates Contact fields defined in Source to Master Fields for the Application object. Inserts/Updates TargetX_SRMb__Checklist_Item__c records. |
| Criteria | Application record created, updated or deleted. |
| Custom Setting | Object name: Recruitment Preferences Field Name:Contact rollup from Application Field API Name: Contact_rollup_from_Application__c |
| Custom Setting Description | When ‘Contact rollup from Application’ is checked, the data from Application will be rolled up to the Contact record by Profile Builder. |
| Package Version | 2.57 - current |
To view common errors that are encountered with the ApplicationTrigger along with a resolution, please see Common errors in Group Assignment migration or refresh.
ApplicationTriggerHandler
| Trigger/Class | ApplicationTriggerHandler Class |
|---|---|
| Object | TargetX_SRMb__Application__c |
| Type | after insert, after update |
| Description | Sets the Application Submitted Date to today when the Application Status becomes “Submitted” and Application Submitted Date is originally null, Sets the Application Fee Submitted Date to today when the Application Fee Received is changed to “True” and Application Fee Submitted Date is originally null. |
| Criteria |
Application Submitted Date is null and Application Status is changed to “Submitted”, Application Fee Submitted Date is null and Application Fee Received is changed to “True.” |
| Custom Setting | Set App Submitted Date, Set App Fee Received Date |
| Custom Setting Description |
Set App Submitted Date: When checked, sets the Application Submit Date to TODAY when the Application Stage field is set to Submitted. The trigger only updates Null values so existing data is not overwritten. Set App Fee Received Date: When checked, sets the Application Fee Received Date to TODAY when the Application Fee Payment Received is set to TRUE. The trigger only updates Null values so existing data is not overwritten. |
| Package Version | Recruitment Manager 2305.1 - present |
EnrollmentHistoryTrigger
-
Trigger/Class EnrollmentHistoryTrigger Object Enrollment History Type before insert, before update, before delete, after insert, after update, after delete, after undelete Description - Matches any enrollment histories to enrollment requirements.
- This will unlink any Application Requirement tasks that are linked to deleted records.
- If enabled, will create new requirements to Enrollment Histories that don't have one.
Affects Enrollment_History__c How affected Unlinks any tasks that are linked to deleted records. Criteria EnrollmentHistory is inserted/updated/deleted. Custom Setting Object Name: Recruitment Preferences
Field Name: Contact rollup from Enrollment History
Field API Name: TargetX_SRMb__Contact_rollup_from_Enrollment_History__cCustom Setting Description When ‘Contact rollup from Enrollment History’ is checked, the data from Enrollment History will be rolled up to the Contact record by Profile Builder. Package Version 2.57 - current
Below are common errors that are encountered with the EnrollmentHistoryTrigger along with a resolution:
Error: Apex trigger TargetX_SRMb.EnrollmentHisotryTrigger caused an unexpected exception; contact your administrator: TargetX_SRMb.EnrollmentHistoryTrigger: execution of AfterUpdate caused by: System.List Exception: List of index out of bounds: 0: (TargetX_SRMb)
Resolution: Source to Master for Enrollment History isn't configured correctly. See Using the Profile Builder for Student/Contacts.
:"TargetX_SRMb.ApplicationTrigger: execution of AfterInsert↵↵caused by: System.DmlException: Update failed. First exception on row 0 with id a0f1N00000CcDCqQAN; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TargetX_SRMb.EnrollmentHistoryTrigger: execution of AfterUpdate↵↵caused by: System.ListException: List index out of bounds: 0↵↵(TargetX_SRMb): []↵↵(TargetX_SRMb)↵↵↵"
status
:
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY
Resolution: Source to Master isn't configured correctly. See Using the Profile Builder for Student/Contacts.
Update failed. First exception on row 0 with id a010f00000TQ7lOAAT; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TargetX_SRMb.EnrollmentHistoryTrigger: execution of AfterUpdate
Resolution: Missing Source to Master 'Order by' clause
Create TargetX_SRMb__Enrollment_History__c - TargetX_SRMb.EnrollmentHistoryTrigger: execution of AfterInsert caused by: System.QueryException: No such column 'Account' on entity 'Contact'.
Resolution: TargetX_SRMb__Enrollment_History__c requires an account ID connection. All required fields on the enrollment history record must also have a connector. This includes the field: Enrollment History Name. See the Form Assembly article Prefill Related Objects and Records with the Salesforce Prefill Connector.
EnrollmentHistoryUpdateTrigger
| Trigger/Class | EnrollmentHistoryUpdateHelper Class |
|---|---|
| Object | TargetX_SRMb__EnrollmentHistory__c |
| Type | after insert, after update |
| Description | Updates the Name of an Enrollment History record to match the linked account (school) record. This is controlled by a setting in RM Preferences. |
| Criteria | An Enrollment History record is inserted with a non-null School or updated with a new School. |
| Custom Setting | Auto-Update EH Name |
| Custom Setting Description | When checked, the Enrollment History Name in the Enrollment History record will be updated with the School value. |
| Package Version | Recruitment Manager 2305.2 - present |
EssayTrigger
| Trigger/Class | EssayTrigger |
|---|---|
| Object | Essay |
| Type | before insert, before update, before delete, after insert, after update, after delete, after undelete |
| Description | This will link new Application Requirements or unlink any Application Requirement tasks that are linked to deleted records. |
| Affects | Essay_c |
| How affected | Unlinks any tasks that are linked to deleted records. |
| Criteria | Essay is inserted/updated/deleted. |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.57 - current |
exportSequenceEnrollmentHistory
- Note: This trigger was deprecated with version 17.30009.
Trigger/Class exportSequenceEnrollmentHistory Object Enrollment History Type After insert, after delete Description Used to assign an export sequence number to Enrollment History records. Used to prioritize records when creating exports that pull multiple records into one data row. Affects TargetX_SRMb__Enrollment_History__c How affected Updates exportSequence__c field Criteria Enrollment History record created/deleted Custom Setting N/A Custom Setting Description N/A Package Version 2.0 - current Below are common errors that are encountered with the exportSequenceEnrollmentHistory along with a resolution:
Invalid Data. Review all error messages below to correct your data. Apex trigger TargetX_SRMb.exportSequenceEnrollmentHistory caused an unexpected exception, contact your administrator: TargetX_SRMb.exportSequenceEnrollmentHistory: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a0C8000000HB7MOEA1; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TargetX_SRMb.CloseEHCheckListItemTrigger: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times) (TargetX_SRMb) : []: (TargetX_SRMb)
Resolution: This error can sometimes be caused by the Official Scores? check-box in the Test tab. When the check-box remains unchecked, the system is able to save updates without error.
exportSequenceExtracorricular
| Trigger/Class | exportSequenceExtracorricular |
|---|---|
| Object | Extra Curricular Activity |
| Type | After insert, after delete |
| Description | Used to assign an export sequence number to Extra Curricular Activity records. Used to prioritize records when creating exports that pull multiple records into one data row. |
| Affects | TargetX_SRMb__Extra_Curricular_Activity__c |
| How affected | Updates exportSequence__c field |
| Criteria | Extra Curricular Activity create/deleted |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.0 - current |
exportSequenceFamilyRelationship
| Trigger/Class | exportSequenceFamilyRelationship |
|---|---|
| Object | Relationship (v1) |
| Type | After insert, after delete |
| Description | Used to assign an export sequence number to Relationship (v1) records. Used to prioritize records when creating exports that pull multiple records into one data row. |
| Affects | TargetX_SRMb__Family_Relationship__c |
| How affected | Updates exportSequence__c field |
| Criteria | Relationship (v1) create/deleted |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.0 - current |
exportSequenceRecommendationr
| Trigger/Class | exportSequenceRecommendationr |
|---|---|
| Object | Recommendation |
| Type | After insert, after delete |
| Description | Used to assign an export sequence number to Recommendation records. Used to prioritize records when creating exports that pull multiple records into one data row. |
| Affects | TargetX_SRMb__Recommendation__c |
| How affected | Updates exportSequence__c field |
| Criteria | Recommendation create/deleted |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.0 - current |
exportSequenceTest
| Trigger/Class | exportSequenceTest |
|---|---|
|
Object |
Test |
| Type | After insert, after delete |
| Description | Used to assign an export sequence number to Test records. Used to prioritize records when creating exports that pull multiple records into one data row. |
| Affects | TargetX_SRMb__Test__c |
| How affected | Updates exportSequence__c field |
| Criteria | Test create/deleted |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.0 - current |
Below are common errors that are encountered with the ExportSequenceTest along with a resolution:
Invalid Data. Review all error messages below to correct your data. Apex trigger TargetX_SRMb.exportSequenceTest caused an unexpected exception, contact your administrator: TargetX_SRMb.exportSequenceTest: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a0J800000056ailEAA; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it. Required fields are missing: [Test Name]: []: (TargetX_SRMb)
Resolution: This error is a result of a blank Name field. Update the Test Name.
InquiryTrigger
| Trigger/Class | InquiryTrigger |
|---|---|
| Object | Inquiry |
| Type | before insert, before update, before delete, after insert, after update, after delete,after undelete |
| Description | A 'cleanup trigger' to manage Inquiry records that could potentially be orphaned if a related Contact/Student record is removed. Adds Profile Builder rollup functionality. |
| Affects | TargetX_SRMb__Inquiry__c |
| How affected | Creates/Updates ContactChildRollup |
| Criteria | Inquiry is inserted/updated/deleted. |
| Custom Setting | Recruitment Preferences: Contact rollup from Inquiry |
| Custom Setting Description | When ‘Contact rollup from Inquiry’ is checked, the data from Inquiry will be rolled up to the Contact record by Profile Builder. |
| Package Version | 2.60 - current |
Below are common errors that are encountered with the InquiryTrigger along with a resolution:
TargetX_SRMb.InquiryTrigger: execution of AfterUpdate caused by: System.ListException: List index out of bounds: 0 (TargetX_SRMb)
Resolution: If the Contact rollup from Inquiry is turned on in Recruitment Manager Preferences you also need to configure a record for the Inquiry object in the Source to Master object.
MiscRequirementTrigger
| Trigger/Class | MiscRequirementTrigger |
|---|---|
| Object | Misc Requirement |
| Type | before insert, before update, before delete, after insert, after update, after delete, after undelete |
| Description | Verifies Misc Requirement are a checkbox and link to a valid field. |
| Affects | Misc_Requirement_c |
| How affected | Exception handling |
| Criteria | Misc Requirements is inserted/updated/deleted. |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.57 - current |
RecheckAllContacts
| Trigger/Class | RecheckAllContacts |
|---|---|
| Object | Contact |
| Type | Batchable |
| Description | Rechecks contacts for completeness of tasks in the event that a contact was merged and test score or enrollment history information became out of sync. |
| Affects | Contact_c |
| How affected | Rechecks and updates tasks as completed. |
| Criteria | N/A |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.57 - current |
Below are common errors that are encountered with the RecheckAllContacts along with a resolution:
'TargetX_SRMb.RecheckAllContacts' for job id '707F000005TKHlt' : Future method cannot be called from a future or batch method: TargetX_SRMb.processApplicationRequirement.fetchRelatedOBJsFut(List<String>, Set<String>)
Resolution: Disable the scheduled cleanup job that runs every night. This means that when Contact records are merged it is not going to check for requirement completeness. Be aware of this when merging records.
- Navigate to the RM Preferences tab.
- In the Application Requirements Manager Configuration section, complete the following:
-
Uncheck the Process Checklist @future box
- Save your changes.
RecheckAllContactsScheduler
-
Trigger/Class RecheckAllContactsScheduler Object Contact Type Schedulable Description Scheduler for RecheckAllContacts. Affects Contact_c How affected Rechecks and updates tasks as completed. Criteria N/A Custom Setting N/A Custom Setting Description N/A Package Version 2.57 - current Below are common errors that are encountered with the RecheckAllContactsScheduler along with a resolution:
'RecheckAllContactsScheduler returning 0 successful results in log. Resolution(s):- Verify Permissions using TargetX Permission Scanner.
- Disable the scheduled cleanup job that runs every night. This means that when Contact records are merged it is not going to check for requirement completeness. Be aware of this when merging records:
- Navigate to the RM Preferences tab.
- In the Application Requirements Manager Configuration section, complete the following:
-
Uncheck the Process Checklist @future box
-
Save your changes.
RecommendationTrigger
| Trigger/Class | RecommendationTrigger |
|---|---|
| Object | Recommendation |
| Type | before insert, before update, before delete, after insert, after update, after delete, after undelete |
| Description | This will link new requirements or unlink any Application Requirement tasks that are linked to deleted records. |
| Affects | TargetX_SRMb__Contact__c |
| How affected | Unlinks any tasks that are linked to deleted records. |
| Criteria | Recommendation is inserted/updated/deleted. |
| Custom Setting | N/A |
| Custom Setting Description | N/A |
| Package Version | 2.57 - current |
Below are common errors (in red) that are encountered with the RecommendationTrigger along with a resolution:
Error:Apex trigger TargetX_SRMb.RecommendationTrigger caused an unexpected exception, contact your administrator: TargetX_SRMb.RecommendationTrigger: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: (TargetX_SRMb)
Resolution: Recommendation status must be set to 'Complete' before 'Completes Requirement' can be checked.
SchoolLookupForEhTrigger
| Trigger/Class | SchoolLookupForEhTrigger |
|---|---|
| Object | Enrollment History |
| Type | before insert, before update |
| Description | Relates an Enrollment History record to an Account record by matching a ceeb code value. |
| Affects | TargetX_SRMb__Account__c |
| How affected | Sets to ID of related Account record |
| Criteria | TargetX_SRMb__eh_ceeb_code__c must have a value |
| Custom Setting | Recruitment Preferences: Automatic School Matching (EH) |
| Custom Setting Description | Updates enrollment history account name based on CEEB code. Uses 0 to pad 5 digit CEEB codes to 6 digits and shorter CEEB codes to 4 digits. |
| Package Version | 2.47 - Current |
StopAccountDelete
-
Trigger/Class StopAccountDelete Object Account Type before delete, before update Description Prevents an Account record from being deleted or updated. Affects N/A How affected N/A Criteria Protect_from_Deletion__c must be true to prevent deletion or update. Custom Setting N/A Custom Setting Description N/A Package Version 2.1 - Current
Below are common errors (in red) that are encountered with the StopAccountDelete along with a resolution:
Apex trigger TargetX_SRMb.StopAccountDelete caused an unexpected exception, contact your administrator: TargetX_SRMb.StopAccountDelete: execution of BeforeUpdate caused by: TargetX_SRMb.DataException: Account cannot be updated: (TargetX_SRMb)
Resolution: This error occurs when the "Protect from Deletion" checkbox is checked on the Account record and the system is trying to update the Account. The trigger blocks any update or any deletion of that Account and its data.
TestRecordTypeUpdate
| Trigger/Class | TestRecordTypeUpdate Class |
|---|---|
| Object | TargetX_SRMb__Test__c |
| Type | after insert, after update |
| Description | Updates the Name and Record Type of a Test record to match the Test Type. Test name and Test Record Type have individual settings in RM Preferences. |
| Criteria | A Test record is inserted with a non-null Test Type or updated with a new Test Type. |
| Custom Setting | Auto-Update Test Type, Auto-Update Test Name |
| Custom Setting Description |
Auto-Update Test Type: When checked, the Record Type field in the Test record will be updated with the value in the Test picklist during insert or update. Auto-Update Test Name: When checked, the Test Name field in the Test record will be updated with the value in the Test picklist during insert or update. When unchecked, the Test Name field in the Test record will instead be updated with the Record ID. |
| Package Version | Recruitment Manager 2305.2 - present |
TestTrigger
| Trigger/Class | TestTrigger |
|---|---|
| Object | Test |
| Type | before insert, before update, before delete, after insert, after update, after delete, after undelete |
| Description | Links/unlinks requirements to Tests that complete them. |
| Affects | TargetX_SRMb__Contact_c |
| How affected | Updates affected records with Test rollup data. |
| Criteria | Test data is added/updated. |
| Custom Setting | Recruitment Preferences: Contact rollup from Test |
| Custom Setting Description | When ‘Contact rollup from Test’ is checked, the data from Test will be rolled up to the Contact record by Profile Builder. |
| Package Version | 2.57 - current |
Below are common errors (in red) that are encountered with the TestTrigger along with a resolution:
Error loading into target [TargetX_SRMb__Test__c] : Error received from salesforce.com. Fields []. Status code [CANNOT_MODIFY_MANAGED_OBJECT]. Message [TargetX_SRMb.TestTrigger: execution of AfterUpdatecaused by: System.ListException: List index out of...
Resolution: This error is typically because Source to Master is active for an object, but there aren't any roll-ups associated to that object.
Check the Custom Setting in Recruitment Manager Preferences to see it Test Rollups are checked:
If this is not being used, uncheck this and it should resolve the load. If you are using this, verify the rollup record for test in Source to Master. Make sure there is only 1 record per object and that there is an Order By clause in place.
