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

Trailhead challenge-The 'AccountTrigger' Trigger does not appear to be working correctly. Inserted records did not have matching BillingState and ShippingState values.
I'm trying to complete this trailhead challenge "Understand Execution Context". And getting this error message.
trigger AccountTrigger on Account (before insert) {
if(Trigger.isBefore && Trigger.isInsert)
{
AccountTriggerHandler.CreateAccounts(Trigger.new);
}
}
This is the trigger i'm using. Please advise.
trigger AccountTrigger on Account (before insert) {
if(Trigger.isBefore && Trigger.isInsert)
{
AccountTriggerHandler.CreateAccounts(Trigger.new);
}
}
This is the trigger i'm using. Please advise.
According to the message the shippingState has to be equal to BillingState, please verify this.
For all the Trailhead issues please report it here,
https://trailhead.salesforce.com/help?support=home#
https://trailhead.salesforce.com/help
So that our trailhead support engineers will look into it and get back to you.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Regards,
Salesforce Support.
public static void CreateAccounts(List<Account> accts) {
for (Account a : accts) {
if(a.ShippingState!=a.BillingState)
a.BillingState=a.ShippingState;
}
}
}
Also validate if you always have a value in ShippingState and BillingState. You could use a system.debug to check the value.