Forum Discussion

DannyIm's avatar
DannyIm
Qrew Member
7 years ago

Deleted record but related records still have a reference to it

Hi,

I have two tables "A" and "B" where "A" has a field that is a numeric reference to "B". 

I have an "A" record, "a", that contains a reference to a "B" record, "b", but when I delete "b", "a" still contains the id of "b" in the reference field when I do a query on "a" (e.g. via API_GetRecordInfo).  However, "a" appears correct via the web interface and doesn't display a reference to "b" at all.

I was wondering if this is expected behavior?  I also noticed that "a" didn't get an updated update_id after I deleted "b".  Is there any way for changes like this to automatically propagate to related records?

Thanks!

3 Replies

  • QuickBase does not support "Cascade Delete" behavior so this is the expected behavior. But it would not be difficult to implement this behavior in script with or without using a Service Worker (there are two entirely different solutions one of which would use a SW). Either way automatically deleting records might cause other issues if the records in question had yet other relationships to other tables.
    • DannyIm's avatar
      DannyIm
      Qrew Member
      I wasn't really thinking of deleting the related records, but more of a "ON DELETE SET NULL" type of behavior.  I see that in the web interface record "a" doesn't appear to have any references to "b" anymore, which doesn't match the response returned by the API. 

      Thanks for the prompt response.
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    What is the reason you are using the API to see if record B has a number in the reference field?

    If you are looking to find connected or not connected values for some query?  If so, and that the GetRecordInfo is causing issues.  You can use a lookup field from the relationship that is always populated to filter your results.