Showing posts with label custom button. Show all posts
Showing posts with label custom button. Show all posts

Custom button: How to pass currency field to an Apex web service?


you can try using the VALUE function to get the decimal value from the currency field before passing it to the webservice method.
Example:
We want to pass decimal value of Opportunity Amount. Then we use below code in custom button to pass decimal value to web-service.
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

var amt = {!VALUE(TEXT(Opportunity.Amount))};
var retVal = sforce.apex.execute("WSclassname", "WSmethod", {oppAmt:amt});
alert (retVal) ;
window.location.reload() ;