Skip to main content
Hi everyone,

I need help with the following problem and was hoping that you can give me some advice:

I want to create a validation that prevents a user from deleting an order product if the Activation Date (Custom Field) is in the past.

I have written the following apex trigger which seems to work okay.

trigger Do_not_delete_activated_order_product on OrderItem (before delete) {

for (OrderItem o : trigger.old )

IF(o.Activation_Date__c < System.today()){

o.adderror('You cannot delete an order product which has already been activated.');

}

}

I now want to deploy this trigger from our developers sandbox to our production org.

Can someone please help me writing the test class and give me advice on how to deploy my trigger? (this is the first time I work with custom code)

Best,

Dorian
1 answer
0/9000