+ Start a Discussion
Amr MohsenAmr Mohsen 

Can I use apex code in existing page

I'm new to salesforce development , I'm wondring if I can use apex code in existing page such cases, leads and so on ? Or Apex code only for custom visulforce page ? and  if it possible how can I do this ?
Shazib MahmoodShazib Mahmood

You can have a trigger that calls on apex code when a record updates/inserts.

Or you can have buttons that invoke apex.

Mahesh DMahesh D
Hi Amr,

When Should I Use Apex?

Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Force.com platform server in conjunction with calls to the Force.com​ 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.

Use Apex if you want to:
Create Web services.
Create email services.
Perform complex validation over multiple objects.
Create complex business processes that are not supported by workflow.
Create custom transactional logic (logic that occurs over the entire transaction, not just with a single record or object).
Attach custom logic to another operation, such as saving a record, so that it occurs whenever the operation is executed, regardless of whether it originates in the user interface, a Visualforce page, or from SOAP API.

Visualforce consists of a tag-based markup language that gives developers a more powerful way of building applications and customizing the Salesforce user interface. With Visualforce you can:
Build wizards and other multistep processes.
Create your own custom flow control through an application.
Define navigation patterns and data-specific rules for optimal, efficient application interaction.

Also please look into the below useful links:







Please do let me know if it helps you.

Amit Chaudhary 8Amit Chaudhary 8
Hi Amr Mohsen,

Welcome to the salesforce world.  Best way to learn salesforce in Trailhead in a fun way.
1) https://developer.salesforce.com/trailhead?utm_campaign=trailhead&utm_source=sfdc&utm_medium=dsc-nav

Please check below post to download salesforce book.
1) http://amitsalesforce.blogspot.in/search/label/Book

Use below link to download all saledforce cheat sheet
1) https://developer.salesforce.com/page/Cheat_Sheets

Apex Book
URL:- http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

Visual Force Book
URL :- http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf

Let us know if this will help you

Amit Chaudhary
JyothsnaJyothsna (Salesforce Developers) 
Hi ,

Please check the below trailhead link for Apex Basics and real-time examples of Apex. The trailhead is a respective learning path through the basic building blocks of the Salesforce1 Platform. Test your knowledge of the platform while earning points and badges to celebrate your achievements.


Hope this helps you!
Best Regards,