function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AbAb 

Creating account from Dev console

Hello,

How is it possible to Create account from apex code.

Thanks
Best Answer chosen by Ab
Shashi PatowaryShashi Patowary
Hi Sandrine,

In the Anonymous window create Account like this -

Account myAcc = Account();
myAcc.Name = 'TestAcc';

Insert myAcc;

Set mandatory fields if required.

Please let me know if thisis helpful.
Regards,
Shashi

All Answers

Shashi PatowaryShashi Patowary
Hi Sandrine,

In the Anonymous window create Account like this -

Account myAcc = Account();
myAcc.Name = 'TestAcc';

Insert myAcc;

Set mandatory fields if required.

Please let me know if thisis helpful.
Regards,
Shashi
This was selected as the best answer
Anshul Sahu 13Anshul Sahu 13
Hi,
yes  it is possible to Create account from apex code.

You can Create a record in the  Account Object  in this way: 

 Account acc = new  Account();
acc.Name = 'Test Account';
Insert acc;

Set mandatory fields if required.

if you want to know full description for all objects then Please go through this link:

https://anshsupportengineer.blogspot.com/2022/12/insert-record-to-object-in-salesforce.html

let me know if this help you.

Happy to help You!

Thanks,
Anshul