My client requires to remove submit for approval button once the record is recalled.
We have a triger that forces record to move to submit for approval depending on the stage status. and approval process critearea is has to be at certain stage to allow submit for approval .
So once it is recalled the status changes to the lower level and at that point submit for approval thing does not work because not meeting the criteria of approval process.
So I need that button to be removed completly once the record is recalled.
Best Answer
Thanks to this wizard's answer in the below question, based on which I am framing my answer to pull of this trick (Do not blame if SF stops supporting or jacks up JS support as they did with home page components):
Changing the color of a custom button
Step 1: Create a fake submit for approval (or) name it anything you want
Step 2: I have the logic to hide the button based on stagename, you can use your any field and make this button disappear conditionally on page load.
Paste this javascript in the base64 encoder
http://rot47.net/base64encoder.html
Step 3: Add this new button to the page layouts of the users who you wish to disable the submit for approval button.
Button syntax should look like :
Final output:
when stage = prospecting ( submit for approval is not visible)
when stage != prospecting the submit button is visible.