Discussions

Expand all | Collapse all

How to handle Deletion of the record in QuickBase?

  • 1.  How to handle Deletion of the record in QuickBase?

    Posted 08-21-2018 09:16
    Hi, I have a table

    Record ID_           Value_
    1                           20
    2                           21
    3                           19
    4                           15
    5                           25



    Deleting a record should be made possible only if Record ID is having maximum Value.
    i.e., here in this situation Record ID=5 deleting should be possible and deleting Record ID=4(or) below, should not be possible.


  • 2.  RE: How to handle Deletion of the record in QuickBase?

    Top
    Contributor
    Posted 08-22-2018 08:35
    Code similar to this will hide the delete button on the ?a=er page if the [Record ID#] is not the largest [Record ID#] value in the table:
    (function(){
      var dbid = "";
      var dbidRecords = "";
      var apptoken = "";
      $.ajaxSetup({data: {apptoken: apptoken}});
      var querystring=document.location.search;
      if(/a=er/i.test(querystring)) {
        $.get(dbidRecords, {
          act: "API_DoQuery",
          clist: "3",
          slist: "3",
          options: "num-1.sortorder-D"
        }).then(function(xml) {
          var maxRid = $("record_id_", xml).text();
          if (kRid !==  maxRid) {
            $("#deleteButton").hide();
          }
        });
      } 
    })();

    However, there are other mechanism by which a record can be deleted and you would have to identify and handle those cases as well. 

    As much as I think script solutions are superior you might want to rethink your workflow and see if you can use roles or other native features so achieve your goal.


  • 3.  RE: How to handle Deletion of the record in QuickBase?

    Posted 08-24-2018 12:23
    Hi Dan, Thank you for responding. what is "dbidRecords"?



  • 4.  RE: How to handle Deletion of the record in QuickBase?

    Top
    Contributor
    Posted 08-24-2018 12:34
    These statements are boilerplate in many scripts and are included even if they are not used:
    var dbid = "";
    var dbidRecords = "";
    var apptoken = "";
    $.ajaxSetup({data: {apptoken: apptoken}});
    By convention dbid is the dbid of the application, dbidRecords is the dbid of Records table and apptoken is the application token.