+ Start a Discussion

Create an account button

Would like to create a button on the case object that will create a person account off the standard fields of the case. I would also like to check and make sure that the person account does not exist first before allowing to create.



You have to simply create a custom button and select action as JavaScript. Now by using JavaScript you can directly access the method define inside the global class. Please go through below code as reference: Path for creating custom button on Case object click on your name -> setup -> customize ->case -> click on custom button and links.


///////////////// Global Class///////////////////////////////////
global class MyTest
WebService static integer addNumbers(integer numOne, integer numTwo)
return numOne + numTwo;


////////////////////////// JavaScipt Code //////////////////////////
var myvar = sforce.apex.execute("yourClass","addNumbers", {numOne:4,numTwo:5}");


hi ,


I have a scenario same like the one which is mentioned in the post.


How to write a test method for the method written in class mentioned here.Please suggest me the approach.