Forum Discussion

AdamKrzyzanek's avatar
AdamKrzyzanek
Qrew Captain
11 months ago

Prevent from Adding & Removing record when Parent table condition Met

I have Parent Table (CM) where in Form I have imbedded child table record (CM CI Pair) to add data.
I want to prevent users at certain point (when Status change to "Approved" to not be able to add new rows to this table and related it with Parent table record).
Example: If CM [CM Status]=Approved, than cannot relate new "CM CI Pair".

With Role setup I can prevent from Edition, but how to prevent from Adding related records?



------------------------------
Adam Krzyzanek
------------------------------

5 Replies

  • Interesting Problem.

    The title of your post refers to preventing ads or deletes under certain conditions.

    A way to prevent Deletes is to replace that with a request deletion checkbox.  Then take away the Permission to Delete from all Roles except Admon.

    The have a Pipeline reset the Request Deletion checkbox and then branch to delete the record if the conditions allow.  Perhaps it would write back to a field with a message the date and time and [Last Modified by] (ie who the requested the delete) if the conditions did not allow, so the user would know why their Request Delete Failed.

    I can't think of a great way to prevent Add right now.  But you could have a Pipeline trigger when a child record is added and conditions don't allow.  Then the new children would be erased practically as soon as they were entered.



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
  • You also might be able to do something either at the FORM level or post save pipeline level by using the parent-child relationship to store the number of "child items" are presently saved and tied to the parent. (#-Children). 

    Then in the Parent-Child relationship besure to include both the Parent Status and #-Children 

    Remember that a detail record doesn't count as saved until it is saved, so your detail form PREVENTS save before saving with the parent status = approved and the #-Children = x. 



    ------------------------------
    joe vandervest
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Qrew #1 Challenger

      I think the challenge here is that the Add Record is being done in Grid Edit.



      ------------------------------
      Mark Shnier (Your Quickbase Coach)
      mark.shnier@gmail.com
      ------------------------------
      • joevandervest's avatar
        joevandervest
        Qrew Cadet

        ah.. sorry. I missed that entirely.  So yeah - Pipelines seems to be the "best" way to fix it - though preventing it prior to save... is another thing entirely. 

        You could also send the "offending" user an email at the tail end of the pipeline - though it's probably more hassle to setup - but it might be worth it. Or - what about blasting the user a CHAT via a chat interface - e.g. "Hey, you can't add or delete items from 'X' !  " 



        ------------------------------
        joe vandervest
        ------------------------------