function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger CreateOpportunityAndContact on Test__c (after insert) { List<Contact> listOfContact = new List<Contact>(); List<Opportunity> listOfOpportunity = new List<Opportunity>(); for(Test__c newTest : Trigger.new){ Contact newContact = new Contact(); newContact.LastName = newTest.NameOfContact__c; listOfContact.add(newContact); Opportunity newOpportunity = new Opportunity(); newOpportunity.Name = newTest.NameOfContact__c; newOpportunity.StageName = 'Qualification'; newOpportunity.CloseDate = Date.Today() + 30; listOfOpportunity.add(newOpportunity); } insert listOfContact; insert listOfOpportunity; }
Please find the below trigger for Example to create a contact and Opportunity Records whenever record is inserted into Custom object,
Thanks,
Vinoth