1

I'm trying to insert a record into a custom object via Execute Anonymous and get Line 2, Column 19 Unexpected Token 'InvA' This is sample code from Trailhead and it uses the Account object as an example and it works. When I try to point to my Custom Object (InvoiceAccount) it errors. I'm using the object's API Name.

// Create the InvoiceAccount sObject 
InvoiceAccount__c InvA = new InvoiceAccount__c(Name='Acme', Account_Owner_Email__c='Tiger5K@outlook.com', Account_Owner_Name__c='Sabrina Smith';
// Insert the InvoiceAccount by using DML
insert InvA;
2

You are missing a closing parenthesis.

InvoiceAccount__c InvA = new InvoiceAccount__c(Name='Acme', Account_Owner_Email__c='Tiger5K@outlook.com', Account_Owner_Name__c='Sabrina Smith';

should be

InvoiceAccount__c InvA = new InvoiceAccount__c(Name='Acme', Account_Owner_Email__c='Tiger5K@outlook.com', Account_Owner_Name__c='Sabrina Smith');

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.