The following function can be used to remove buttons in the custom record.
function removeButton(scriptContext) {
try {
if (scriptContext.newRecord.type == "customrecord_jj_landed_cost_inb"){
if (scriptContext.type == 'edit' || scriptContext.type == 'view') {
let hideFld = scriptContext.form.addField({
id: 'custpage_hide_buttons',
label: 'not shown - hidden',
type: serverWidget.FieldType.INLINEHTML
});
let scr = "";
// //Hiding the Attach button under Escalation
scr += 'jQuery("#attach.rndbuttoninpt").hide();';
scr += 'jQuery("#tr_attach.tabBnt").hide();';
// //Hiding the Customise View button in View mode
scr += 'jQuery("#customize.rndbuttoninpt").hide();';
scr += 'jQuery("#tr_customize.tabBnt").hide();';
//Hiding the New landed cost volume button in View mode - RP
scr += 'jQuery("#newrecrecmachcustrecord_jj_link_custom_record.rndbuttoninpt.bntBgT").hide();';
scr += 'jQuery("#tr_newrecrecmachcustrecord_jj_link_custom_record").hide();';
//Hiding the New item based item receipt deatils button in View mode - RP
scr += 'jQuery("#newrecrecmachcustrecord_jj_landed_cost_volume.rndbuttoninpt.bntBgT").hide();';
scr += 'jQuery("#tr_newrecrecmachcustrecord_jj_landed_cost_volume").hide();';
// //Hiding the New landed cost volume button in Edit mode - SB
scr += 'jQuery("#newrec327.rndbuttoninpt").hide();';
scr += 'jQuery("#tr_newrec327.tabBnt").hide();';
//Hiding the New item based item receipt deatils button in Edit mode - RP
scr += 'jQuery("#newrec842.rndbuttoninpt").hide();';
scr += 'jQuery("#tr_newrec842.tabBnt").hide();';
hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>";
}
}
}
catch (e) {
log.error("Error @ beforeLoad", e);
}
}