You need to sign in to do that
Don't have an account?
Apex Trigger: Update Custom Checkbox on Financial Account Record if Linked to "Closed Won" Opportunity
Hi All,
For context and background, I am working with an organization that is using Financial Services Cloud. Within FSC, there is a custom object called "Financial Accounts" and within this object there is a record type called "Credit Card".
Within opportunities, we are creating a workflow where users are forced to link a valid credit card (financial account) record in order to close their credit card-related opportunities. I am looking to create a trigger (and test class for eventual deployment) on the financial account record so that a custom checkbox field called "Linked To Won Opportunity" (API: LinkedToWonOpp__c) is set to TRUE when it has been linked to an opportunity record where the Stage = Closed Won. Conversely, I want create the trigger so it also updates this field "Linked To Won Opportunity" to FALSE if the opportunity record in which it was linked is either changed back from Closed Won to any open status OR if the link between the financial account record and opportunity no longer exists (i.e. the user deleted the card record ID from the Financial Account (lookup) field placed on the opportunity).
Any help or direction is GREATLY appreciated.
Thanks,
Ricki
For context and background, I am working with an organization that is using Financial Services Cloud. Within FSC, there is a custom object called "Financial Accounts" and within this object there is a record type called "Credit Card".
Within opportunities, we are creating a workflow where users are forced to link a valid credit card (financial account) record in order to close their credit card-related opportunities. I am looking to create a trigger (and test class for eventual deployment) on the financial account record so that a custom checkbox field called "Linked To Won Opportunity" (API: LinkedToWonOpp__c) is set to TRUE when it has been linked to an opportunity record where the Stage = Closed Won. Conversely, I want create the trigger so it also updates this field "Linked To Won Opportunity" to FALSE if the opportunity record in which it was linked is either changed back from Closed Won to any open status OR if the link between the financial account record and opportunity no longer exists (i.e. the user deleted the card record ID from the Financial Account (lookup) field placed on the opportunity).
Any help or direction is GREATLY appreciated.
Thanks,
Ricki
As per my understanding I think one trigger logic is enough.
Try the below code.
If works for you pls mark it as a best answer so that it helps others too.
Thanks.