Set colour for custom button which added using workflow

/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 */
define(["N/record", "N/log", "N/redirect", "N/ui/serverWidget"], function (
  record,
  log,
  redirect,
  ui
) {
  function beforeLoad(context) {


    try {
        log.debug("In btn color change");


        let form = context.form;
        let newFieldview26 = form.addField({
          id: 'custpage_activity',
          type: 'INLINEHTML',
          label: 'Activity 1'
      });


      let html26 = "<script></script><style>input#custpageworkflow2200 {background-color: #00b300 !important;color: white !important;} input#custpageworkflow2208 {background-color: red !important;color: white !important;}</style>";
      newFieldview26.defaultValue = html26;
      
    } catch (error) {
      log.error("Error in beforeLoad", error);
    }
  }


  return {
    beforeLoad: beforeLoad
  };
});


Leave a comment

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