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
lokesh lokkilokesh lokki 

Write an anonymous script that create an Account, 2 cases against the Account.

CharuDuttCharuDutt
Hii Lokesh
Try Below Code In Anonymous Window
Account Acc  new Account();
Acc.name = 'Test Account';
Insert Acc;

Case c = new Case();
   c.AccountId = Acc.Id;
   c.Subject = 'Test Case 1';
   c.Status = "New";
   c.Origin = "Phone";
 insert c;

Case c1 = new Case();
   c1.AccountId = Acc.Id;
   c1.Subject = 'Test Case 2';
   c1.Status = "New";
   c1.Origin = "Phone";
 insert c1;
Please Mark It As Best Answer If It Helps
Thank You!
lokesh lokkilokesh lokki
i want 1 opportunity also in that what is the code to do