Apex Introdction In SalesForce

Reading this article, we can learn how to create and test Apex code in SalesForce.

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
 
Apex Introdction In SalesForce
 
Step 2
 
Now, we can create new Apex Class Hello.apxc named as Hello,
 
Apex Introdction In SalesForce
 
Apex Introdction In SalesForce
 
After creating Apex class Hello,
 
Apex Introdction In SalesForce
 
Add a display method for displaying a text,
 
Apex Introdction In SalesForce
 
Finally, the Hello.apxc class code is,
  1. public class Hello {  
  2.    public static void display()  
  3.    {  
  4.       system.debug('Welcome to Csharp Corner');  
  5.    }  
  6. }  
Step 3
 
For Debugging the Apex class Hello, Click Debug menu and Select Open Execute Anonymous Window,
 
Apex Introdction In SalesForce
 
Now, write the Apex code for calling the display method, and enable the Open log option for viewing output and click Execute
 
Hello.display();
 
Apex Introdction In SalesForce
 
Step 4
 
Now we can verify the output, after clicking Execute, Log will be open automatically and select Debug Only option
 
Apex Introdction In SalesForce
 

Summary

 
Now you have successfully tested the Apex code in Salesforce environment.