Add color to the workflow buttons using jQuery.

  let color, buttonId = []; //ids of the buttons we get get the id by inspect the page and from elements we can get the IDs.

          color = ‘ #008000’;

  const changeButtonColor = (color, buttonIds) => {

            try {

                // Creating a jQuery script string to be inserted into the HTML

                let buttons = buttonIds.map(buttonId => `

                   jQuery(function($) {

                      var buttonElement = jQuery(“#${buttonId}“);

                       if (buttonElement.length) {

                        buttonElement.css({ “background-color”: “${color}“, “color”: “white” })

                         .each(function() {

                        this.style.setProperty(‘background-color’, ‘${color}‘, ‘important’);

                        this.style.setProperty(‘color’, ‘white’, ‘important’);

                            });

                     }

                   });

                `).join();

                let script = `<script>${buttons}</script>`;

                return script;

            } catch (error) {

                log.error(“error@renameButton”, error);

            }

        }

Leave a comment

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