CSS Styles to Custom button in Suitelet

We can add the CSS styles to the custom button on the Suitelet page

let form = serverWidget.createForm({title: "Report Page"});
form.addButton({
   id: 'custpage_button_email',
   label: 'Send Email',
   functionName: "consolidatedEmail"
});
let buttonBarField = form.addField({
   id: 'custpage_process_bar',
   type: serverWidget.FieldType.INLINEHTML,
   label: 'Progress bar'
});
buttonBarField.defaultValue = [
     '<style>',
     'td#tdbody_custpage_button_email {',
     'background-color: #568cd7 !important;',
     'font-size: 20px !important;',
     'color: #ffffff !important;',
     'height: 26px !important;',
     '}',
     'td#tdbody_secondarycustpage_button_email {',
     'background-color: #568cd7 !important;',
     'font-size: 20px !important;',
     'color: #ffffff !important;',
     'height: 26px !important;',
     '}',
     '</style>',
].join("\n");
scriptContext.response.writePage(form);

Leave a comment

Your email address will not be published. Required fields are marked *