function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sudhirn@merunetworks.comsudhirn@merunetworks.com 

Disable or hide submit for approval button in history section

Hi Experts, 

 We have a custom object SPR__c which has submit for approval button in history section this need to be removed or disabled since we have custom button new submit for approval this will be used 

 Please suggest me how to remove this button from history section I tryed below method adding code inside new submit for apporval button but it doesn't seem to be working 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> 
<script>
 $(document).ready(function() {  
      $("input[name='piSubmit']").hide();
   }); 
 </script>

Please suggest. 

Thanks
Sudhir

 
NagendraNagendra (Salesforce Developers) 
Hi Sudhir,

First and foremost sincerely regret delayed reply.

I was able to use a sidebar component and jQuery to remove the Submit for Approval button.  We needed some custom logic to execute before the record entered the approval process so we added a custom button to submit for approval and removed the submit for approval button on the Approval History section by adding the following sidebar component.  Note this will break if Salesforce changes the name of the button component "piSubmit". Replace the ###### with a reference to a static resource with the jQuery.js. You can't use the functions in sidebar components for URLFOR.
<script src="/resource/#############/jQuery"></script>
<script>
  $j = jQuery.noConflict();

  // Added a check for a specific custom object
  if(window.location.href.indexOf(".com/a14") != -1) {
    $j(document).ready(function() {     
      $j("input[name='piSubmit']").hide();
    });
  }
</script>
Kindly mark this post as solved if the information help's so that it gets removed from the unanswered queue and becomes a proper solution which results in helping others who are really in need of it.

Good Luck.

Best Regards,
Nagendra.P