Activity Forums Salesforce® Discussions Issues with Custom Buttom in a Salesforce Opportunity

  • Aman

    Member
    May 1, 2018 at 8:34 am

    Hi Rafi,

    You can execute the below logic on your custom button :

    <apex:page standardController="Opportunity">
    <apex:detail Subject="{!Opportunity.Id}" relatedList="true" title="true" oncomplete="Javascript:location.reload();" />

    <script src = "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type = "text/Javascript">

    var jquery = $.noConflict();
    jquery(document).ready(function(){

    var $buttons = jQuery("[name= 'discount_approval']");
    if ('{!Opportunity.StageName}' != 'Proposal/Price Quote' && '{!Opportunity.StageName}' != 'Negotiation/Review'){

    $buttons.toggleClass('btnDisabled', true).attr('disabled', 'disabled');
    }
    });
    </script>
    </apex:page>

    Abhi

  • Parul

    Member
    September 17, 2018 at 11:49 am

    Hello,

    Basically, you need to develop a logic in which a custom button is shown when Stage is 'Closed Won' else hide the custom button.

    Rest of the code, @Aman has already provided to you.

    Hope this helps you to understand the problem.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos