Delete not working

Delete not working

We are creating a benchmarking survey, which requires admin user to create a survey (by selecting from a list of questions they want to include). This generates a version of the survey which is then completed by the user. 

We have a list of surveys page with a delete action, however when we publish the application, an error message appears when we try and delete a version, which says :

The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_919_SURVEYRESULTS_OSUSR_919_SURVEYQUESTION_SURVEYQUESTIONID". The conflict occurred in database "OUTSYSTEMS", table "dbo.OSUSR_919_SURVEYRESULTS", column 'SURVEYQUESTIONID'. The statement has been terminated.

Can anyone guide us on how to correct this error?


Is there a child record you need to delete first?
Hi Attiyah,

The error tells you what are the entities/columns with issues.

You are trying to delete a SURVEYQUESTION but you have a records in SURVEYRESULTS that references it.
The SURVEYRESULTS.SURVEYQUESTIONID has a "Delete Rule" set to "Protect" causing the exception.

If you want the results to be automatically deleted when a question is deleted then you should change the "Delete Rule" property of the SurveyQuestionId from "Protect" to "Delete":

João Rosado