• Dharma teja 22
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.
For this challenge, you need to create a trigger that, before insert or update, checks for a checkbox, and if the checkbox field is true, sets the Shipping Postal Code (whose API name is ShippingPostalCode) to be the same as the Billing Postal Code (BillingPostalCode).
The Apex trigger must be called 'AccountAddressTrigger'.
The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.


trigger AccountAddressTrigger on Account (before insert,before update) {
List<Account> acclst=new List<Account>();
  for(account a:trigger.new){
    if(a.Match_Billing_Address__c == True && a.BillingPostalCode!= null){
    a.ShippingPostalCode=a.BillingPostalCode;
        
    }

}
}

Then i will get the above error on saving the trigger .....
how tom solve this error.......
Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.
For this challenge, you need to create a trigger that, before insert or update, checks for a checkbox, and if the checkbox field is true, sets the Shipping Postal Code (whose API name is ShippingPostalCode) to be the same as the Billing Postal Code (BillingPostalCode).
The Apex trigger must be called 'AccountAddressTrigger'.
The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.


trigger AccountAddressTrigger on Account (before insert,before update) {
List<Account> acclst=new List<Account>();
  for(account a:trigger.new){
    if(a.Match_Billing_Address__c == True && a.BillingPostalCode!= null){
    a.ShippingPostalCode=a.BillingPostalCode;
        
    }

}
}

Then i will get the above error on saving the trigger .....
how tom solve this error.......
Hi everyone !

I'm doing Trailhead actually, and i have a difficulty to finish the chaleng from Data Security.

Following your company's Sales Kickoff meeting, teams have realigned and a number of new strategic positions have been added to the Sales organization, including a Training Coordinator, Sales Strategy Manager, and Chief Sales Officer.
The Sales Strategy Manager reports to the Chief Sales Officer, and also directly supervises the Training Coordinator. The Chief Sales Officer reports directly to the CEO.
Please create the necessary roles on the hierarchy to accommodate these organizational changes.
The labels for the roles must match those in the description with the resulting 'Role Name' being the same except using underscores instead of spaces.


I know how to add a Role, but that's all..

Thanks again for your help !