Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

GDPR: SQL to delete all traces of a purchase order?



What is the best way to delete all traces of a purchase order from the commerce database, based on the tracking number? I know how to resolve the object id from OrderGroup_PurchaseOrder...

Should I delete directly from the tables, or is it preferable to use the stored procedures instead?

I just want to make sure that I delete *all* data related to the purchase order (except data in the catalog, etc :) ).

Apr 14, 2020 9:31
Sanjay Kumar - Apr 14, 2020 17:57
Hi Patrik,
If you proceed to delete PO with Quan Mai's suggestion so that should be the best approach.

Hi Patrik, I will suggest stored procedures with the BEGIN TRAN clause once all delete queries execute then COMMIT TRAN else ROLLBACK TRAN for safer hand.

And we also delete PII data from the products so refer below link for deleting GDPR PII data.

Edited, Apr 14, 2020 10:57

I'm not an GDPR expert, but as far as I understand, orders are financial contracts that override the rules. So you don't have to delete orders to be GDPR-compatible.

In case you really want to delete an order, I suggest to go with API instead

var order = OrderContext.Current.GetPurchaseOrder(trackingNumber);



Apr 14, 2020 14:55
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.