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
sushma76sushma76 

Delete failed - ENTITY_IS_DELETED, entity is deleted

Hi,

On the Quote Line Item there is a custom button called - Add New Product. This custom button is linked to a VF page called CustomProductAdd.

When user clicks on this custom button he is presented a page where he enters - Product Name and Product Description. 
Next he clicks on Add New Product.

Then another section is displayed on the same page ( custom product add) asking for more details about the product. The product added on this custom page is suppose to be added to PRODUCT2 table. 

The product gets added to the table but somehow the page is not refreshed and goes into an infite loop and throws these errors :-
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Delete failed. First exception on row 0 with id 0QL50000000WHS4GAO; first error: ENTITY_IS_DELETED, entity is deleted: []
Error is in expression '{!leavePage}' in page customproductadd: Class.AddPartController.leavePage: line 260, column 1
An unexpected error has occurred. Your development organization has been notified.
/////////////////////////////////////////////////////////////////////////////////

In the AddPartController the Leavepage displays following code :-

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

public void leavePage(){

        for(quoteLineItem qli2 :QuoteNewLineItemList){
            system.debug('TO BE DELETED =' + qli2.ID); 
        }
        List<QuoteLineItem> delQli = new List<QuoteLineItem>();
        if(QuoteNewLineItemList != null && QuoteNewLineItemList.size() != 0 && QuoteNewLineItemList.isempty() == false){
            for(QuoteLineItem qlid : QuoteNewLineItemList){
                if(qlid.IsDeleted != true){
                    delQli.add(qlid);
                }
            }
            delete delQli;
        } 
    }

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

the above function is being called out in the VF Page like this :-


<apex:actionfunction name="runExit" action="{!leavePage}" />


Can you suggest the reason for this error? A different developer did this coding for us and some thing seems to be broken now.

thanks.
//////////////////////////////////////////////////////////////////////////////////////////
Bhanu PartapBhanu Partap

Hi sushma, 
Please share complete vf code and controller code. if possible

What i understand in QuoteNewLineItemList duplicate records with id "0QL50000000WHS4GAO" are their thats why ENTITY_IS_DELETED error thrown.