You need to sign in to do that
Don't have an account?
Hiral Patel 25
create new account with type=customer direct and industry=banking and new opportunities record will be created using trigger
create new account with type=customer direct and industry=banking and new opportunities record will be created using trigger
trigger triggeraccount0209 on Account (after insert)
{
list<Opportunity> olist = new list<Opportunity>();
if(trigger.isafter && trigger.isinsert)
{
for(Account a: trigger.new)
{
if(a.type=='customer direct ' && a.industry=='banking')
{
Opportunity o= new Opportunity();
o.AccouuntId= a.id;
//populate all the necessary fields
olist.add(o);
}
}
if(olist.size()>0)
{ insert olist;}
}
}
All Answers
You can try checking the below code and modify it to match your scenario:
Please do note that the above is a sample code.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
trigger triggeraccount0209 on Account (after insert)
{
list<Opportunity> olist = new list<Opportunity>();
if(trigger.isafter && trigger.isinsert)
{
for(Account a: trigger.new)
{
if(a.type=='customer direct ' && a.industry=='banking')
{
Opportunity o= new Opportunity();
o.AccouuntId= a.id;
//populate all the necessary fields
olist.add(o);
}
}
if(olist.size()>0)
{ insert olist;}
}
}
If this helps can you mark this as best answer so that it can be useful for others in the future.