Forum Discussion
_anomDiebolt_
7 years agoQrew Elite
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:
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.
(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.