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

Fire a Trigger
Hello all,
I am new to Salesforce.Can anyone please help with this problem.
I am trying to Build a trigger.The trigger should fire whenever an Account object is modified.The trigger should detect if the billing address on the Account has changed.If the Account billing address has changed, the new billing address should be copied to all Contact records related to that account
I am new to Salesforce.Can anyone please help with this problem.
I am trying to Build a trigger.The trigger should fire whenever an Account object is modified.The trigger should detect if the billing address on the Account has changed.If the Account billing address has changed, the new billing address should be copied to all Contact records related to that account
Below code should work for you:
BTW, i guess you can also achieve this via process builder instead of a trigger.
Thanks,
Shailesh.
All Answers
Below code should work for you:
BTW, i guess you can also achieve this via process builder instead of a trigger.
Thanks,
Shailesh.
You can use following code to achieve that.
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
We can achieve this by Lightning Process Builder
Follow below steps to create a process to update If Account Billing Address ISCHANGED to Associated Contacts
Step1: steup > Create > Workflows&Approvals > Process Builder >New > Name your Process
Step2: Choose Object and Specify When to Start the Process > Account & Start the process > when a record is created or edited
Step3: Define Criteria for this Action Group > Criteria Name > Is Billing Address Changed & Criteria for Executing Actions > (Select)Filter conditions are met. Next Set Filter Conditions as shown in screenshot
Step4: IMMEDIATE ACTIONS > update Records > Action Name > Update Billing Address > Object (SELECT==> [Account].Contacts) as shown in screen shot & Set Object Variables (Field mapping)
Step5: Acitvate the Process
If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.
Thank you
BLearn - Sai
Thanks.
I am getting an error
Compile Error: Invalid field MailingCity for SObject Account at line 17 column 34.
Any Insights.
Thanks,
Shailesh.