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
bonny mankotiabonny mankotia 

I just want to know how to update the same trigger?

rigger OppOnAccount on Account(after insert,after update) 
{
    if(trigger.isinsert)
    {
      list<opportunity> Listopp  = new list<opportunity>();
        for(account acc:Trigger.new)
        {
            opportunity opp = new opportunity();
            opp.name = acc.name;
            opp.AccountId = acc.id;
            opp.StageName = 'Proposal';
            opp.CloseDate= system.today()+10;
            Listopp.add(opp);
        }
        
            insert Listopp;
     }   
AshlekhAshlekh
Hi,

Please elaborate more what issue you are facing and what is meaning of "what is how to update the same trigger".

-thanks
Ashlekh Gera 
bonny mankotiabonny mankotia
Hello AKG,
My Question is simple i just want to know what is the Trigger code for to update the same record if we Edit the Record?

Thanks.
Mathew Andresen 5Mathew Andresen 5
if you remove  if(trigger.isinsert)  then the trigger will work on inserting AND updating of the record