You need to sign in to do that
Don't have an account?
pradeep m 27
Error: Compile Error: expecting a right parentheses, found 'Id' at line 7 column 31
trigger accountTestTrggr on Account (before insert, before update){
for(Account a: Trigger.new){
List<Contact> contacts = [select id, department, firstname, lastname, email from Contact where accountId = :a.Id];
for(Contact c: contacts){
System.debug(Contact Id[' + c.Id + '], FirstName[' + c.firstname + '],LastName[' + c.lastname +']);
c.Description=c.department+ ' ' + c.firstName + ' ' + c.lastname;
update c;
}
}
for(Account a: Trigger.new){
List<Contact> contacts = [select id, department, firstname, lastname, email from Contact where accountId = :a.Id];
for(Contact c: contacts){
System.debug(Contact Id[' + c.Id + '], FirstName[' + c.firstname + '],LastName[' + c.lastname +']);
c.Description=c.department+ ' ' + c.firstName + ' ' + c.lastname;
update c;
}
}
Take a look into the salesforce Trailhead to understand more about trigger and its best practice - https://developer.salesforce.com/trailhead
Thanks,
Karanraj (http://www.karanrajs.com)
System.debug('Contact Id[' + c.Id + '], FirstName[' + c.firstname + '],LastName[' + c.lastname +']');
Thanks