0
trigger accountTestTrggr1 on Account(before insert, before update) {
    for (Account a: Trigger.new) {

        List < Contact > contacts = [select id, salutation, 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.salutation + ' ' + c.firstName + ' ' + c.lastname;

            update c;
        }
    }
}
  • 1
    the error is from the system.debug statement. you have to correct the format of the parameters you are trying to debug.. properly concatenate them and it should work – Vamsi Krishna Jun 28 '15 at 23:33
2

Your System.debug statement should look like this:

System.debug('Contact Id[' + c.Id + '], FirstName[' + c.firstname + '], LastName[' + c.lastname +']');

(You were missing a ' character). Also, you can't break lines in Apex - you need to concatenate a string to do that.

0

This is the signature of debug method.you had missed the ' character ,which is the required part for that method.

debug(logLevel, msg) Writes the specified message, in string format, to the execution debug log with the specified log level. Signature

public static Void debug(LoggingLevel logLevel, Object msg)

System.debug('Contact Id[' + c.Id + '], FirstName[' + c.firstname + '], LastName[' + c.lastname +']');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.