Hide new quote button on opportunity

SOLVED

Hi

is there any way i can hide the 'new' button on the quotes tab on the opportunity (based on a value on the oppo record)?

ive tried various things but doesnt seem to work, this is what ive tried:

<script>
crm.ready(function () {
if (oppo_stage=="BC") {
crm.hideButton("newquotes.gif");
}
})
</script>

Parents
  • +1
    verified answer

    I haven't tested this...but I think you need to define the value of the oppo_stage field.  I think this should work for you.

    Also don't forget your script tags when placing this in Custom Content.

    crm.ready(function () {
    var oStage = crm.fields("oppo_stage").val();
    if (oStage=="BC") {
    crm.hideButton("newquotes.gif");
    }
    });

    If the above does not work, I would double check the code (rather than translation) for BC and I would double check the gif.

    Hope this helps!

  • 0 in reply to Michele Gaw

    actually it didnt work - when you add the code into the custom content and save it shows with the 'new' button as hidden but if you click on the quotes tab to refresh the screen the 'new' button is back!

  • 0 in reply to SIQ

    Sorry!  I didn't look at the screen to see that the stage of the opportunity is not displayed on the screen.  That script will only work if the field is displayed on the screen as it is reading from the screen!

    I think the quickest way to solve this would be to add the stage to the top content area of the opportunity screen.  Within the Opportunity entity, you will find a screen named OppoTopContent.  Add the oppo_stage field to this screen.  When you return to the Quotes List for an opportunity, you will see the stage displayed at the top of the screen to the right of the Opportunity information already displayed.

    Sorry, I have not tested this.  However, this should allow the script provided to work as it will be able to read the value from the field on the screen.

    Otherwise, you will need to change up the script to obtain the oppos id, find the oppo record, then define the value of the stage from the record with a variable and use that variable rather than the oStage variable I defined above.

    Hope this helps!

  • 0 in reply to Michele Gaw

    i tried to do that - so i added the oppo stage field to the top content then on the quotes tab on the quote filter box i added the script into the custom content screen but still cant get it work

Reply Children
No Data