Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Cascade Delete not working

tltoulson
Kilo Sage

Has anyone seen a situation where the cascade delete does not work and what did you do to fix it?

 

Here's the scenario:

 

I have two tables (Table 1 and Table 2 lets say).   Table 2 has a reference field on it that references Table 1.   On the dictionary, I have the Reference cascade rule set to delete.  

 

So then I create a record on Table 1 and a related record on Table 2.   I delete the record on Table 1.   At this point I would expect to get the warning, click ok and the record on Table 2 would be deleted as well.   Instead, the record on Table 2 is still there and the reference has instead been cleared.

 

Any thoughts?

1 ACCEPTED SOLUTION

twofirstnames
Kilo Expert

Hi Travis - it worked for me AFTER I cleared the instance cache.


View solution in original post

3 REPLIES 3

williamsun
Mega Guru

My first question would be if you can share the "Reference cascade rule" code.


Without that I would suggest testing with debug lines into the log or adding comments to the Table 2 record so you know how far it goes.


Make sure all the permissions are good.


Make sure you are deleting the Table 2 queried GlideRecord and not just deleting the value of the reference field on Table 1



just off the top of my head.


twofirstnames
Kilo Expert

Hi Travis - it worked for me AFTER I cleared the instance cache.


Hi Dale,



Thank you!   I didn't even think to clear the cache.   Worked perfectly!