Hide Cancel Request button

by Community Manager on ‎09-27-2012 07:48 AM

Question

 

Is there a way I can hide the out of the box Cancel Request button at a certain status?

Answer

You can use a customized UI rule.

Here is a ui rule to hide an action button. just modify it to hide cancel button:

function hideWFButton(buttonLabel, flag) {
 //Check if user have the rights to perform workflow action
 if(null != document.getElementById("DIV_EC_REQUEST_WF_AVAILABLE_ACTIONS")) {
 
  var wf_buttons;
  var links;
  var newDisplay;
  
  wf_buttons = document.getElementById("DIV_EC_REQUEST_WF_AVAILABLE_ACTIONS");
  links = wf_buttons.getElementsByTagName("a");
  
  //determin the new style
  if(flag) {
   //hidden
   newDisplay = "none";
  } else {
   //display
   newDisplay = "table-cell";
  }
  
  //go through all buttons
  for(var i = 0; i<links.length; i++) {
   //if button matches with given name, aply the new style to the button
   if(links[i].firstChild.nodeValue == buttonLabel) {
    links[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = newDisplay;
    break;
   }
  }
 } 
}

Search
Showing results for 
Search instead for 
Do you mean 
HP Blog

HP Software Solutions Blog

Featured


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.