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

How do you create the checkbox object for the apex trigger unit 1/2 challenge?
Please help! I am having trouble with the appex trigger challenge 1/2. I think I know how to do the logic, I am just forgetting how to create a checkbox on here. Thanks!
If you are trying to compare a checkbox field on a record you can do this
A small thing to note, Booleans do not quite act as expected if the feild value is null. For more info, read this http://fourq.me/blog/what-the-hell-boolean-i-thought-i-knew-you/
All Answers
If you are trying to compare a checkbox field on a record you can do this
A small thing to note, Booleans do not quite act as expected if the feild value is null. For more info, read this http://fourq.me/blog/what-the-hell-boolean-i-thought-i-knew-you/
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.
for that
go to setup->custmize->accounts->field->Account Custom Fields & Relationships->checkbox-> label -> save
after that create a trigger.
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account a : Trigger.new)
{
Boolean checkboxValue = a.Match_Billing_Address__c;
if(a.Match_Billing_Address__c == true )
{
a.ShippingPostalCode = a.BillingPostalCode;
}
}
}
and voila!