Recently, while working on Yansa Lab’s Simple SDLC application, I came across a problem with deleting records. When I would delete a project, the sub-records would not be deleted. In Simple SDLC, projects have sprints and sprints have stories. If I deleted a project, none of the sprints or stories would get deleted. Similarly, if I deleted a sprint, none of the stories would be affected. While trying to figure out how to fix this problem, I came across ServiceNow’s documentation on configuring cascade delete rules.
I discovered that if you configure the dictionary on a reference field, there is an option to delete all referenced records when that record is deleted. This option is called “Cascade” and can be found under Reference Specification – Additional Customization > Reference cascade rule in the advanced view of the dictionary.
Once I had all of my reference fields set to Cascade, they deleted the correct records. Now, when I delete a project, I am also deleting all of its sprints and stories.