You need to sign in to do that
Don't have an account?
jonathanbernddf20131.387825590468351E12
Javascript button to call apex method help
I've written a trigger and class that work currently off a checkbox being true on the parent object. Now I'd like to replace this checkbox with a button 'Publish'. Could you help me figure out where the 'missing link' is between my very rudimentary js and my method. I know the button is on an object, but I'm not seeing exactly how to tell the button execute the method on this record on this SObject now.
Here's the beginnings of my js.
Here's the beginnings of my js.
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} var pubApp = sforce.apex.execute("PubVersionNumber", "buttonVersionNumber", {}); window.alert("App is Published." );
All Answers
Simple question would be if you declared your buttonVersioNumber method as 'webservice static'?
At the bottom of the link it says: Use the following line to display a popup window with debugging information:
sforce.debug.trace=true;
Perhaps that will give you a line where to go?
<apex:commandButton action="{!myApexMethod}" value="publish" id="theButton"/>
If there is any problem you can use simply use actionFunctions
See the following example.(not tested)
<input id="theButton" type="submit" name="theButton" value="Publish" />
<apex:actionSupport event="onclick" action="{!myApexMethod}" />