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
Bobby YungBobby Yung 

When changing status of Booking (Opportunity) to 'closed', I'm getting the error: 'Object (id = 0060I00000dElwv) is currently in trigger OpportunityTrigger, therefore it cannot recursively update itself'

Hi, 

I'm a green Salesforce Admin.

I'm trying to close this Booking (Opportunity) by changing the stage fom 'Closed Won' to 'Closed', but gettign the error: 

Object (id = 0060I00000dElwv) is currently in trigger OpportunityTrigger, therefore it cannot recursively update itself

I can see the Apex Trigger in the Object Manager, but I don't have any experience with development, so I can;t tell why this error is occuring. 

 
Best Answer chosen by Bobby Yung
Naveen KNNaveen KN
I think they are trying to update the same record in this apex method 

 Opportunity_Helper.updateInventories(trigger.newMap, trigger.oldMap);

check that class and method for any update statement on opportunity sObject. 

--
Naveen K N

All Answers

Naveen KNNaveen KN
Please post the trigger code so that we can have a look at it. 

--
Naveen K N
Bobby YungBobby Yung

Thanks for looking Naveen.

We haven't put the Booking (Opportunity) as 'Cancelled', but going forward to 'Closed' or back to 'Final Proposal' we get this error . Some of the pricing of the products /Booking line items may have changed.

When creating a new Booking (Opportunity) that replicates this one, it goes through to 'Closed'.

 

/*    ----------------------------------------------------------------
    Created by:        Timothy Fabros
    Company:        Bluewolf
    Date Modified:    18 / 08 / 2014
    ----------------------------------------------------------------
    TRIGGER: Opportunity
    
    contains actions to update related opportunity line items when 
    the opportunity stage is set to 'Cancelled'.
    ----------------------------------------------------------------
*/
trigger OpportunityTrigger on Opportunity (before insert, before update, after insert, after update, after delete, before delete) {
    if(trigger.isBefore) {
        if(trigger.isUpdate) {
            Opportunity_Helper.updateInventories(trigger.newMap, trigger.oldMap);
        }

        if(trigger.isDelete) {
            Opportunity_Helper.OLIDeleteLogic(trigger.oldMap);
        }
    }
     
    if (trigger.isAfter) {
        if(trigger.isUpdate) { 
            Opportunity_Helper.updateCancelledProducts(trigger.new);

            // 2015-03-19 FB-275 louis.wang@bluewolf.com
            //    Update custom fields for custom fiscal year info. These fields will be used for reporting.
            //    If Close Date on Opportunity is changed, then update the Fiscal fields on applicable Opportunity Products
            Opportunity_Helper.updateOliFiscalFields(trigger.new, trigger.oldMap);
            
            Opportunity_Helper.updateReserved(trigger.newMap, trigger.oldMap);
        }
    }
}

Naveen KNNaveen KN
I think they are trying to update the same record in this apex method 

 Opportunity_Helper.updateInventories(trigger.newMap, trigger.oldMap);

check that class and method for any update statement on opportunity sObject. 

--
Naveen K N
This was selected as the best answer
Bobby YungBobby Yung

Hi Naveen,

Thanks for your help and time.

I'm not sure awhat you mean by:
check that class and method for any update statement on opportunity sObject. 

Bobby YungBobby Yung

Thanks for your help Naveen. With that information that was enough. 

It was due to adjusting the price of certain inventory.