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='[email protected]', Account_Owner_Name__c='Sabrina Smith';
// Insert the InvoiceAccount by using DML
insert InvA;

1 Answer 1

2

You are missing a closing parenthesis.

InvoiceAccount__c InvA = new InvoiceAccount__c(Name='Acme', Account_Owner_Email__c='[email protected]', Account_Owner_Name__c='Sabrina Smith';

should be

InvoiceAccount__c InvA = new InvoiceAccount__c(Name='Acme', Account_Owner_Email__c='[email protected]', Account_Owner_Name__c='Sabrina Smith');

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .