Forum Discussion

AngelRodriguez's avatar
AngelRodriguez
Qrew Assistant Captain
4 years ago

Set custom table rule to prevent deletion of a record if child record count is greater than 0

I have a Processes table (parent) and a Tasks table (child). In my Processes table, I have a count of completed child tasks that I'm keeping track of to display to users and for an automation I added. Is there a way to write a custom data rule for the Processes table where it looks for the count of tasks, if the number is greater than 0, show a warning message and do not allow the user to delete the record? Right now, I have a custom table rule that reads:

If (
    [Number of Completed Tasks] > 0,
      "There are currently " & [Number of Completed Tasks] & " completed tasks that belong 
      to this process. If you'd like to delete this process, please delete all completed 
      tasks for this process first."
)​

But I'm not sure how to get this system to stop the delete process if the Tasks condition is true.

------------------------------
AR
------------------------------
  • Here is how I have implemented putting a permission on deleting.  For regular users who are not an admin level I remove the ability to delete.  

    Then I make a checkbox on the parent record called [Request Deletion].

    Then I make a pipeline or a automation which obviously will run under its own permissions and it will be triggered when the check box is checked and it will do the dirty deed to delete that record.  

    I would then make a formula URL button to check the checkbox but only present that button to the users if the conditions you require are true.  You could also put belt and suspenders on that by making sure that the automation or pipeline did not delete the records if your condition or not true.  

    Pending on the user experience you want you could decide if you want to check the chat box with the formula URL button which would check the checkbox and land the user somewhere else.   Alternative is that the user check the checkbox but of course the record will immediately redisplay to the user because the record will display quicker than the automation or pipeline will fire. That may be a good enough experience, or else you might want to make a URL formula button which would check the checkbox on the land the user on the dashboard or table homepage for example



    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------