You need to sign in to do that
Don't have an account?
![mukesh gupta 8 mukesh gupta 8](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Trailhead trigger check chellange button
Hi Expert,
I am doing trailhead trigger and using code this
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account a : Trigger.new){
If (a.Test_LightingCo__Match_Billing_Address__c == true && a.Test_LightingCo__BillingPostalCode__c != Null) {
a.Test_LightingCo__ShippingPostalCode__c = a.Test_LightingCo__BillingPostalCode__c ;
}
}
}
but code is working fine and Account object records update perfect. but if i clicks on "check chellange" button on trailhead trigger page then , i got an error
![User-added image](/forums/servlet/rtaImage?eid=9060G000000XedY&feoid=Body&refid=0EM0G000000c0gN)
Please suggest
Thanks
Mukesh
I am doing trailhead trigger and using code this
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account a : Trigger.new){
If (a.Test_LightingCo__Match_Billing_Address__c == true && a.Test_LightingCo__BillingPostalCode__c != Null) {
a.Test_LightingCo__ShippingPostalCode__c = a.Test_LightingCo__BillingPostalCode__c ;
}
}
}
but code is working fine and Account object records update perfect. but if i clicks on "check chellange" button on trailhead trigger page then , i got an error
Please suggest
Thanks
Mukesh
when you create new account record you can see it on screen
go to below link for understand compund address fields
https://releasenotes.docs.salesforce.com/en-us/spring14/release-notes/rn_schema_compound_fields_address.htm
and below link for account object all api standard fields
here you can find both fields in the list
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm
i hop it helps you
Please mark it best answer if it helps you so it make proper solution for others
Thanks
All Answers
The name of the custom field should be 'Match_Billing_Address__c' . Edit it . Then try the below trigger.
Regards
Please suggest.
Thanks
Mukesh
you can create another developer fresh org for doing this trailhead challange.
and use above code provided by Eldon
Thanks
Also you are using Test_LightingCo__BillingPostalCode__c instead of the std field BillingPostalCode . Change that also.
I have create new DE for this issue but now have a same problem ""
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account a : Trigger.new){
If (a.Match_Billing_Address__c == true && a.BillingPostalCode__c != Null) {
a.ShippingPostalCode__c = a.BillingPostalCode__c ;
}
}
}
Acount record is update perfectly. But check chellange button show the error.
Please suggest.
Thanks
Mukesh
try this code Thanks
let me inform if it helps you
Here "BillingPostalCode" and "ShippingPostalCode" is a custom object, so API name will be "BillingPostalCode__c" and "ShippingPostalCode__c" without "__c" suffix , how we cam menage.
Thanks
Mukesh
and Match_Billing_Address__c is a boolean custom feld on account
i hop it helps you
thanks
Use the code i gave above. Challenge is to create one custom field Match_Billing_Address__c use the std fields BillingPostalCode and ShippingPostalCode . For std field you dont have to append __c. The code is given below again
Regards
But "ShippingPostalCode" and "BillingPostalCode" is not available in Account object list.
How i can get these standard fields in my Account object.
Thanks
Mukesh
when you create new account record you can see it on screen
go to below link for understand compund address fields
https://releasenotes.docs.salesforce.com/en-us/spring14/release-notes/rn_schema_compound_fields_address.htm
and below link for account object all api standard fields
here you can find both fields in the list
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm
i hop it helps you
Please mark it best answer if it helps you so it make proper solution for others
Thanks
Those fields come under Shippingaddress and billingaddress. Please try the above code let us know the result.
Regards