Skip to main content

As the title says, the sample code in the module instructions generate an error where the console says that the account number must be more than 8 characters long. I use the same code as provided in the example:

Account acct = new Account(Name='SFDC Account');

insert acct;

// Once the account is inserted, the sObject will be

// populated with an ID.

// Get this ID.

ID acctID = acct.ID;

// Add a contact to this account.

Contact mario = new Contact(

    FirstName='Mario',

    LastName='Ruiz',

    Phone='415.555.1212',

    AccountId=acctID);

insert mario;

---------------------------------------------------

However this generates the following error:

 

Sample Insert Related records not working.

Anybody have any ideas as to what might be going on?

 

Thanks.

2 answers
  1. Dec 14, 2023, 6:33 AM

    Hi @Alejandro Carrera ,

     

    I think the settings for the previous challenge remain. Please deactivate.

     

    Go to Setup -> Object manager -> Choose (Account )-> Validation Rules.

    Find that validation rule and deactivate it.

0/9000