In Execute Anonymous, I'm trying to bulk-process a list of sObjects by passing a list to the DML operation with multiple fields. When I just define the 'Name', it works. When I add Field1 and Field2, I get the error below.

Line: 4, Column: 105 Invalid identifier '’John’'. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_'.

// Define the list
List<PT_PIPROJ__AccountInsertTestObj__c> acctList = new List<PT_PIPROJ__AccountInsertTestObj__c>(); 
// Create PT_PIPROJ__AccountInsertTestObj__c sObjects
PT_PIPROJ__AccountInsertTestObj__c a1 = new PT_PIPROJ__AccountInsertTestObj__c(Name='Account3',  Field1=’John’, Field2=’Doe’); 
PT_PIPROJ__AccountInsertTestObj__c a2 = new PT_PIPROJ__AccountInsertTestObj__c(Name='Account4’, Field1=’Jane’, Field2=’Smith'); 
// Add accounts to the list
// Bulk insert the list
insert acctList;

1 Answer 1


You need to use the proper single quote character ('), whereas you have used some other single quote character ().

  • 2
    It's a Smart Quote, probably from some Microsoft Office editor.
    – sfdcfox
    Nov 20, 2018 at 18:34
  • 1
    or slack, getting that on daily basis
    – kurunve
    Nov 20, 2018 at 18:40

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.