You need to sign in to do that
Don't have an account?
maninder singh 50
Apex Triggers Challenge
When attempting to create my Apex trigger for this Trailhead development exercise, I receive about 20 errors similar to Unexpected token '<'. , Unexpected token 'and'. etc.
trigger AccountAddressTrigger on Account (before insert, before update) {
List<Account> acc = [Select id from account where Id in :trigger.new and BillingPostalCode!= null and Match_Billing_Address__c == true];
for(Account a: acc)
{
a.ShippingPostalCode = a.BillingPostalCode;
}
}
If i use below query there are no errors.
List<Account> acc = [Select id, Match_Billing_Address__c from account where Id in :trigger.new and BillingPostalCode!= null];
So, there is something wrong with the other Match_Billing_Address__c field and I validated that the API name is correct. I know there are other solutions available for same challenge but please help in debugging this.
trigger AccountAddressTrigger on Account (before insert, before update) {
List<Account> acc = [Select id from account where Id in :trigger.new and BillingPostalCode!= null and Match_Billing_Address__c == true];
for(Account a: acc)
{
a.ShippingPostalCode = a.BillingPostalCode;
}
}
If i use below query there are no errors.
List<Account> acc = [Select id, Match_Billing_Address__c from account where Id in :trigger.new and BillingPostalCode!= null];
So, there is something wrong with the other Match_Billing_Address__c field and I validated that the API name is correct. I know there are other solutions available for same challenge but please help in debugging this.
It seems that the Field Match_Billing_Address__c is of type Checkbox. Is my Understanding correct..???
Also you need not put '==' in the SOQL query. It should be single '=' sign
So, if Match_Billing_Address__c is of type Checkbox, Update your SOQL as below:
Let me know if it helps. Mark this as the solution if it solved your purpose.
Let me know if you need any more assistance.
Thanks & Regards,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com
All Answers
It seems that the Field Match_Billing_Address__c is of type Checkbox. Is my Understanding correct..???
Also you need not put '==' in the SOQL query. It should be single '=' sign
So, if Match_Billing_Address__c is of type Checkbox, Update your SOQL as below:
Let me know if it helps. Mark this as the solution if it solved your purpose.
Let me know if you need any more assistance.
Thanks & Regards,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com
try this:
Hope this will help :)
Thanks
Vinod