You need to sign in to do that
Don't have an account?

Help with a Trigger
Hi there,
We at UNICEF require a little help with the creation of a Trigger and related TestClass for the following scenario:
We have a custom object called Due Diligence (Due_Diligence__c).
This is an object that has a MasterDetail relation to Account.
Due Diligence records are managed by researchers and the process ends with a DD Outcome assigned to the Due Diligence Record (PickList field called: DD_Phase_1_Outcome__c) at the DD record level.
The record is then put through a standard Approval Process.
We would like that at the Approval, when DD record is approved the approval process updates a field on the Due Diligence record called DD Record Status (Approval_status__c) with a status of “Phase 1 Review Completed”, the DD record then updates the Account in the relevant field in the Account record (DD_Outcome_Phase_1__c) with the outcome coming from the DD Records.
We would also want to pass the Approval Date also from the DD Record to the Account record.
Currently we are handling that via a series of Workflow but we only have the ability to update the Account record after 1 hour (we are using Time Based Field Updates)
Thanks,
L
We at UNICEF require a little help with the creation of a Trigger and related TestClass for the following scenario:
We have a custom object called Due Diligence (Due_Diligence__c).
This is an object that has a MasterDetail relation to Account.
Due Diligence records are managed by researchers and the process ends with a DD Outcome assigned to the Due Diligence Record (PickList field called: DD_Phase_1_Outcome__c) at the DD record level.
The record is then put through a standard Approval Process.
We would like that at the Approval, when DD record is approved the approval process updates a field on the Due Diligence record called DD Record Status (Approval_status__c) with a status of “Phase 1 Review Completed”, the DD record then updates the Account in the relevant field in the Account record (DD_Outcome_Phase_1__c) with the outcome coming from the DD Records.
We would also want to pass the Approval Date also from the DD Record to the Account record.
Currently we are handling that via a series of Workflow but we only have the ability to update the Account record after 1 hour (we are using Time Based Field Updates)
Thanks,
L
Take a look at below code and try to use it:
NOTE:
Assuming the approval date on account objects api name is Approval_Date__c (as you havent mentioned any, if not replace it in the class code). This code works if the status is
Trigger code:
Apex Calss That handles requests from trigger:
Test Class:
Hope it helps,
If you find any compile erros, post the error back, i will reply to it .,
UNICEF keep rocking!!
Thanks,
Balaji C Garapati