« March 2007 | Main | June 2007 »

April 17, 2007

Creating your first Apex Code

One of the amazing things that is going on at Salesforce right now is we are creating our own on demand programming language. It's really easy to create a Hello World example using Apex Code in Salesforce. Right now you can create your own custom web service by simply putting the key word 'WebService' in front of your method.

1) To make this work you just need an Apex Code enabled DE org.

2) read these docs

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

Instead of doing the extended example in the docs create a simple hello world apex example. Here is the code:

package myFirstPackage {
webService String helloWorld(String name){
return 'Hello '+name;
}
}

3) Now install the Ajax Toolkit in your DE org

http://www.salesforce.com/appexchange/detail_overview.jsp?id=a0330000002foeKAAQ&NavCode__c=

4) And go into your DE org and execute it, you get a nice UI to edit and execute your example. This link will give you help on using the Ajax toolkit

http://wiki.apexdevnet.com/index.php/Ajax_Tools


That's it for HelloWorld running server side inside the Apex Platform.

Posted by Chris at 04:51 PM