Salesforce is a cloud based online solution for customer relationship management, or CRM. Salesforce provides all of our departments like marketing, sales, commerce, and service with a shared view of our customers with a single integrated CRM platform.
Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on Salesforce servers in conjunction with calls to the API. Using syntax that looks like Java and acts like database stored procedures, Apex enables developers to add business logic to most system events, including button clicks, related record updates, and Visualforce pages. Apex code can be initiated by Web service requests and from triggers on objects. – Salesforce
Reading this article, you can learn how to create and test Apex code in SalesForce.
The prerequisites are for Apex programming in SalesForce as, R Register a Salesforce Free Trail account using this
link.
Step 1
Login to your Salesforce Account and Click the Developer Console
Step 2
Now, we can create new Apex Class Hello.apxc named as Hello,
After creating Apex class Hello,
Add a display method for displaying a text,
Finally, the Hello.apxc class code is,
- public class Hello {
- public static void display()
- {
- system.debug('Welcome to Csharp Corner');
- }
- }
Step 3
For Debugging the Apex class Hello, Click Debug menu and Select Open Execute Anonymous Window,
Now, write the Apex code for calling the display method, and enable the Open log option for viewing output and click Execute
Hello.display();
Step 4
Now we can verify the output, after clicking Execute, Log will be open automatically and select Debug Only option
Summary
Now you have successfully tested the Apex code in Salesforce environment.