i have a custom button on Quote detail page, on click of this button i am calling a function through javascript.
On load of this Quote detail page, If the Quote status is 'Accepted' then i need to disable this button. if the Quote status is something else then i need to enable this button. On click of the button(when enable) i want to change the Quote status to 'Accepted'.
i don't know how to achieve this. i tried doing it with javascript but it doesn't work for me.
below is my javascript code of the custom button.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
if("{!Quote.Status}" != "Accepted"){
var QuoteId = "{!Quote.Id}";
alert(QuoteId);
sforce.apex.execute("GenerateXMLOnQuoteAccept","generateXML",{QId:QuoteId});
alert('done');
}
button setting:
Behavior: Execute Javascript
Content Source: Onclick Javascript