Customer eSpace delete Contacts error

I want to delete contacts from the default Customer eSpace delivered with the apps.

However if I do so, I get the following error:
Error in advanced query Contact in Removealldata in Home in MainFlow in CRM (delete from {Contact}): The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_pjv_CaseHistory_OSUSR_HFZ_CONTACT_CONTACTID". The conflict occurred in database "s_004_0223", table "dbo.OSUSR_PJV_CASEHISTORY", column 'CONTACTID'. The statement has been terminated. 

This to me looks like there are some hidden tables used by the Case-app.

How do I delete contacts ??? See the attached Customers.OML
It's even worse, there is also a reference to a CASE-table which can not be viewed from the OML.
How can I get a hold on all the hidden tables !!!
Hi Joop,

You probably have the Cases app also installed on your Agile Platform, which has a couple of entities with Foreign Key with Protect delete rule to Customer. You will have to make sure you delete these Cases or CaseHistorys prior to deleting that Customer.


There is no Case eSpace installed … or maybe in the past, but not now.
I’ll try to get and install the Case eSapce
Re-publishing Cases won't solve the problem, quite the oposite... it will only create another set of tables that will also have constraints to Customer's "Contact" entity. :(

If you no longer have the Cases eSpace, it is best that you DROP TABLE on the offending (old) entities. I believe these may be OSUSR_PJV_CASE, OSUSR_PJV_CASEHISTORY and OSUSR_PJV_CONTACTUSER, but please double check.


Just published the Case eSapce ... :-(
And yes it made up the mess even bigger. Installing the app modified the Customer eSpace as well (WHY ???)
I now try to delete the data in the tabels of the cases and then remove the case Space again ...

How come the apps modify tables in the customer eSpace ?
Even putting them on read only 
The Customer eSpace is a common resource between Campaigns, Cases, Website and Sales apps. This allows for seamless integration of any of these apps if you are testing more than one on the same server. But since we wanted people to also be able to eval only one of the apps if they so chose, it means that Customer is part of all 4 solutions, meaning every time you publish one app it will make the "original" version the running version. Your modified version should still be on the server with a later version number, though.

As for the apps, they don't really modify tables in the Customer eSpace. They just have their own Entities that have foreign keys to Customer's therefore creating a DB constraint.

Hope this helps,

Got the idea, however if I delete an eSpace like the CASE, it should also delete the tables from the database.
It looks like it only deletes the eSpace and not the tables, that's the reason why I ran into this problem.

It was actually a conscious design option back in 2001 not to delete any data from abandoned tables (or table columns that no longer map to attributes). :)

The reason for this is the clear potential for data loss if the user did it recklessly and also to minimise data corruption from these very same constraint/reference problems from other eSpaces (or custom tables) that meanwhile may have been made to reference a deleted eSpace table.

Because of this we decided at OutSystems that data deletion would always have to be a human assisted process, via conventional DB management tools.

If you really want to nuke some of the tables, this thread will point you towards a script that may help.



One additional comment : It seems to be that a fresh trial cloud instllation already contains sample data ...
I just created a complete clean new cloud trial and uploaded oml's without any bootstrap what so ever.
And presto all default sample customer/contact/case/casehistory/visitors are already present.
And I'm not able to delete customers/contacts because those relate to the case/casehistory tables which can not be accessed !!
To me this is not the way it should be. A fresh installation should NOT have any sample data unless I upload/bootstrap it in an OML.
Hi Joop,

The cloud trials were designed with two main objectives in mind:

1) Allow people to start trying out some of the sample apps as quickly as possible, and allow them to make incremental changes (like the tutorials) on them for learning purposes;
2) Also for learning purposes, obviously to allow the creation of new apps/eSpaces;

To reduce the application activation time to the bare minimum inside a cloud trial sandbox and allow for that "as quick as possible" approach, publishing a full solution and bootstrapping it on demand was not a viable proposition. This means that "clean" cloud trials already contain a fair amount of pre-provision for the 12 apps a user may want to activate.

That is the reason you see both the tables, constraints and seed data already in place after a new activation. There was a trade-off here and we took it.


Thanks Miguel clear answer.
Now I know we can't go on like this :-)
would be nice to make this clear to everybody !

Hi Joop,

What are you trying to do?
That shouldn't be an issue on a normal instalation.

João Rosado
Ha João,

As Miguel explained the trial cloud versions are not "normal" installations.

A customer of ours wanted to start with OutSystems and was using his trial cloud.
There was a lot of (pre-installed) customer/contact data in it, so we thought to get rid of it by using a delete action, but that's not possible on the trial cloud instance.

So we ended up in starting a real (normal) Amazon Cloud and now it works like a charm :-)
End of this story and for everybody using the trial cloud: IT'S A TRIAL ENVIRONMENT FILLED WITH DATA FOR ALL APPS !!