Reset Customer Module

Hi,

An erp consultant asked me to remove all customers (persons) from a test site along with associated data like org links etc. Basically reset the customer module. They have a LOT of customers so manually doesn’t work.

I’m looking for a db script for this and would be grateful for one :slight_smile:

Litium version: 7

Something like this should do it:

DELETE FROM Security.PasswordLoginInfo WHERE NOT SystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonOrganizationLinkRoles WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonOrganizationLink WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonGroupLink WHERE NOT PersonSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonFieldData WHERE NOT OwnerSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.PersonAddress WHERE NOT OwnerSystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')
DELETE FROM Customers.Person WHERE NOT SystemId IN ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000002')

The excluded GUIDs are for the system and everyone user.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.