Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a trigger to update parent account phone number whenever the contact phone number is updated using trigger handler and helper class in Salesforce #14

Open
vijayk3327 opened this issue Aug 27, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@vijayk3327
Copy link
Owner

In this post we are going to learn about How to Write a trigger to update parent account phone number when ever the contact phone number is updated using trigger handler and helper class in Salesforce

Real time scenarios:- Write a trigger on Contact to update the parent Account Phone number when ever the Contact Phone is updated through trigger handler and helper class in Salesforce.

👉 To get source code live demo link, Click Here.

Create Apex Class Trigger
Step 1:- Create Apex Class : contactTrigger.apxt

`TRIGGER contactTrigger ON Contact (BEFORE INSERT, BEFORE UPDATE, BEFORE DELETE, after INSERT, after UPDATE, after DELETE, after undelete) {

IF(TRIGGER.isBefore ){
    system.debug('I am before trigger ');
}
ELSE IF(TRIGGER.isAfter){
    system.debug('I am after trigger ');
    IF(TRIGGER.isUpdate){
        contactTriggerHandler.afterUpdateHelper(TRIGGER.new);
    }
}

}`

👉 To get source code live demo link, Click Here.

@vijayk3327 vijayk3327 added documentation Improvements or additions to documentation question Further information is requested labels Aug 27, 2023
@vijayk3327 vijayk3327 self-assigned this Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

1 participant