Discussions

Expand all | Collapse all

Lock record from edits after a certain condition is met

  • 1.  Lock record from edits after a certain condition is met

    Posted 02-18-2019 04:36
    Hi all,

    I'm currently trying to track the person who changed a particular status to 'Closed', without the added capability of QuickBase's audit logs atm.

    Right now, this is my text formula and it's working fine.

    If ([Status]="Closed",UserToName([Last Modified By]))

    However, there is a possibility that this might be changed in the case whereby someone modifies it accidentally afterwards, etc. 'Closed' entries should only be available for viewing and not editable afterwards - unless allowed.

    I wonder if there is any way i could 'lock' the record in place from any future edits so that the information recorded is as accurate as possible? Or that a particular group of user would be unable to edit henceforth unless an administrator changes the 'Status' to open, etc.

    Thank you!

    Regards,
    Samuel




  • 2.  RE: Lock record from edits after a certain condition is met

     
    Posted 02-18-2019 05:26
    I would simply set a custom permission for editing records on that table for each role you want to check.

    The custom permission would only allow editing privileges for that particular role if the status was not equal to closed.

    Of course, allow admins to always be able to edit in case you ever need the override you mention.

    Hope this helps!

    ~Rob


  • 3.  RE: Lock record from edits after a certain condition is met

    Posted 02-18-2019 05:53
    This works well. Thank you!

    Regards,
    Samuel


  • 4.  RE: Lock record from edits after a certain condition is met

    Posted 03-04-2020 08:00

    Is there a way to do similar in Grid Edit?

    When Lock MD = Yes than you cannot Edit other Field anymore?

    Lock Field when Yes
    Rule #1 for Locking field



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



  • 5.  RE: Lock record from edits after a certain condition is met

    Posted 09-17-2020 15:39
    @Adam Krzyzanek I believe, but not entirely sure, it may be possible to lock this down via Custom Data Rules. (Located under Advanced Settings in any table, at the bottom)
    Add a field (Field name - Current User, field type - Formula Text) that pulls users and ties them to their role, and returns the role value. (i.e. Admin, Tier 1, Tier 2)
    Case(true,
    User() = "Bob", "admin",
    User() = "Steve", "Tier 1",
    "")
    Then add the custom data rule code, something like:
    if([Edit Status] = "Locked" and [Current User] <> "Admin", "Sorry but you may not edit this record. Please speak with a supervisor")

    Please note I have not tested this yet, but this is something i have been wanting to do and will probably be trying to do here soon. I will post an update once i have confirmed or determined its not possible. Hopefully this helps some one and maybe they can flesh the idea out before i get around to it.

    ------------------------------
    Dillion Moore
    ------------------------------



  • 6.  RE: Lock record from edits after a certain condition is met

    Posted 09-17-2020 15:51
    Instead of having to maintain a list of users and what text role they may be in you could simply pull the actual current users role. Going by names might work if their company is only a few people but it will quickly break down when more users get added or if another user has the same name.

    https://login.quickbase.com/db/6ewwzuuj?a=dr&rid=201


  • 7.  RE: Lock record from edits after a certain condition is met

    Posted 09-17-2020 16:16
    Austin K, that's a good point, my company is currently only low double digits, so i guess instead something like:
    if([Edit Status] = "Locked" and toText(UserRoles("Name"))<> "Administrator", "Sorry but you may not edit this record. Please speak with a supervisor")
    Thanks for that catch! Still learning the functions, didnt even think to look past User to see if there was a userRole.

    ------------------------------
    Dillion Moore
    ------------------------------