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
Shaikh RayyanShaikh Rayyan 

i want to create related contact for account with name dummy without duplication trigger

AnkaiahAnkaiah (Salesforce Developers) 
Hi Rayyan,

When ever accont created, do you want to create contact??

Thanks!!
Shaikh RayyanShaikh Rayyan
yes. related contact as named dummy contact
 
AnkaiahAnkaiah (Salesforce Developers) 
Try with below code.
 
trigger ContactCreation on Account (after insert) {
list<Contact> lstCon = new list<Contact>();
    for(Account Acc: trigger.new){
        Contact con = new Contact ();
        Con.FirstName = 'Dummy';
        Con.AccountId = Acc.Id;
        Con.LastName = Acc.Name;
        lstCon.Add(Con);
        
    }
insert lstCon;
}

If this helps, Please mark it as best answer.

Thanks!!
 
Shaikh RayyanShaikh Rayyan
not working!!
AnkaiahAnkaiah (Salesforce Developers) 
Any error in the  trigger??
AnkaiahAnkaiah (Salesforce Developers) 
You need tp create a trigger on account object and insert the account record and check wether contact has been created or not.