SObject List syntax error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}
up vote
2
down vote
favorite
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
acctList.add(a1);
acctList.add(a2);
// Bulk insert the list
insert acctList;
apex compile-error
add a comment |
up vote
2
down vote
favorite
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
acctList.add(a1);
acctList.add(a2);
// Bulk insert the list
insert acctList;
apex compile-error
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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
acctList.add(a1);
acctList.add(a2);
// Bulk insert the list
insert acctList;
apex compile-error
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
acctList.add(a1);
acctList.add(a2);
// Bulk insert the list
insert acctList;
apex compile-error
apex compile-error
edited Nov 20 at 18:33
Adrian Larson♦
103k19110233
103k19110233
asked Nov 20 at 18:31
Boots
689
689
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
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 at 18:34
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
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 at 18:34
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
add a comment |
up vote
5
down vote
accepted
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 at 18:34
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You need to use the proper single quote character ('
), whereas you have used some other single quote character (’
).
You need to use the proper single quote character ('
), whereas you have used some other single quote character (’
).
answered Nov 20 at 18:34
Adrian Larson♦
103k19110233
103k19110233
2
It's a Smart Quote, probably from some Microsoft Office editor.
– sfdcfox
Nov 20 at 18:34
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
add a comment |
2
It's a Smart Quote, probably from some Microsoft Office editor.
– sfdcfox
Nov 20 at 18:34
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
2
2
It's a Smart Quote, probably from some Microsoft Office editor.
– sfdcfox
Nov 20 at 18:34
It's a Smart Quote, probably from some Microsoft Office editor.
– sfdcfox
Nov 20 at 18:34
1
1
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
or slack, getting that on daily basis
– kurunve
Nov 20 at 18:40
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f240032%2fsobject-list-syntax-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown