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
Jes@NZJes@NZ 

Create a child object when a customer is created

Hi 

 

I need to create a child object when a user is created.

 

I tried inside the "after insert" trigger but I can't.

 

Any idea how to solve it?

 

Thanks

Jes

Satish_SFDCSatish_SFDC

Are you doing this:

 

 

 

trigger MyTrigger on User (after insert) {
Contact c = new Contact();
c.LastName='test';
insert c;
}

 

I tried with Contact but you can use your own object.

Also this trigger is not a bulk trigger, so you might have to change it later.

 

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.