You need to sign in to do that
Don't have an account?
Kartik Dangre 15
how to write code when Account updated Contacts created and AS Contact created Opportunity also get created
Hi,
How to write code when Account updated Contacts will created and as Contact created Opportunity also get created
How to write code when Account updated Contacts will created and as Contact created Opportunity also get created
If we go step by step,
Step 1: Create an 'After Trigger' on Account object to create the corresponding Contacts.
--> You have to add proper condition as it is in update, make sure that the Contact is creating only the required update is happening on the Account.
Step 2: Create an 'After Trigger' On Contact object to create the corresponding Opportunity record.
Regards,
Mahesh
I have written code below:
//Automatically create an Contact when an Account is created
trigger AccCon on Account (after insert)
{
List<Contact> NewConn = new List<Contact> ();
for(Account Acc: trigger.new)
{
Contact C = new Contact();
//Con.FirstName= 'Surbhi';
C .LastName= 'Hanu';
C .Title='IAS';
C .Email='Surbh.h@gmail.com';
C .Phone='8149';
C .AccountId= Acc.Id;
NewConn .add(C );
}
insert NewConn ;
}
but contact record is not created.
Please try below code..
Thanks,
Parteek
Below is the code for your Account's Trigger:
Similar way you can write for Contact object as well. But the above code works only for Account Creation. Means whenever you create an Account, it will create the Contact record.
Regards,
Mahesh