I created a testClass that inserts an originalOrder with a product of a quantity : 4. Then, i created a reduction order related to the OriginalOrder. Now, I tried to add product to the reductionOrder but i couldn't insert the products. I'm having this Error: System.DmlException: Insert failed. First exception on row 0; first error: ENTITY_IS_LOCKED, Unable to modify activated Order: cannot delete Order, or add or remove Order Products: [] Class.TestDataFactory.createOrderItems: line 79

Does anyone know why i'm having this ERROR ? how can I add product to a reductionOrder ? enter image description here

This is the DataFactory enter image description here

need Help plz !

  • Welcome to SFSE; Please see How to Ask. Please don't post screenshots of your code - rather, use the code editing tools in edit
    – cropredy
    Commented Mar 23, 2022 at 19:35

1 Answer 1


Just a guess, but check your TestDataFactory.createReductionOrder method to see if it's activating the order (StatusCode='Activated').

If not, check for any triggers that might be activating it automatically.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .