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
rao venkyrao venky 

Contact trigger

Create contact on account by writing trigger Please send the code???
Shashikant SharmaShashikant Sharma
You could read about triggers and get examples over here : http://forceschool.blogspot.in/search/label/Apex%20Triggers (http://forceschool.blogspot.in/search/label/Apex%20Triggers)
Amit Chaudhary 8Amit Chaudhary 8
Please Refer below blog for Trigger framwork :-
http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html

Please let us know if this will help you.

Thanks
Amit Chaudhary
Ajay K DubediAjay K Dubedi
You can use the below trigger to insert a contact every time an account is inserted.
trigger newContact on Account (after insert) 
{
account a=trigger.new[0];
    list<contact> lt=new list<contact>();
        contact c=new contact();
        c.lastname=a.name+'_contact';
        c.AccountId=a.Id;
        lt.add(coffee);
    }
    insert lt;
}

Let me know if this helps.