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
Hector DiazHector Diaz 

Trigger just fire one time

My trigger fires every time when the record its updated, how to prevent because i need to fire just once.
thanks in advance.

trigger QARejectUpdatesOppStage1_RAMU_VINIT_3 on QA_Order_Control__c(after insert,before update){

//Unlock opportunity
//Update the opportunity stage to '08. Delivery  Invoiced' for 17.Invoiced QAOC and update the QAOC to the opportunity page
Map<Id,Id> oppQAIdMap=new Map<Id,Id>();
for(QA_Order_Control__c qaoc:Trigger.New){
    if(qaoc.Status__c=='17. Invoiced'&& qaoc.Country_user__c=='MX') {
//Update fields
list<Opportunity> listOpps=new list<Opportunity>();
listOpps=[Select id,StageName,QA_Order_Control__c from Opportunity where id IN:oppQAIdMap.keySet()];
for(Opportunity opp:listOpps){
    opp.StageName='08. Delivery Invoiced';
        opp.Block_Sales_Team__c= false;
        //update this field;

        update listOpps;
    }catch(System.Dmlexception e){
         system.debug (e); 

Balaji BondarBalaji Bondar
Hi Hector,

Triggers are at the object level and will fire based on the triggering event.In above trigger, trigger will fired for every record insert and updates.
Trigger will process  only records which are satisfying if(qaoc.Status__c=='17. Invoiced'&& qaoc.Country_user__c=='MX')  condition.
Hector DiazHector Diaz
Hi Balaji
thanks for your answer, but may be exists code for stooping the loop and fire just once, what do you thing?