function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amr MohsenAmr Mohsen 

Can I use apex code in existing page

Hello, 
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
Hi,

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

Or you can have buttons that invoke apex.

Thanks
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.

Apex
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
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:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_when_use_apex.htm

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_what_is_apex.htm

https://www.udemy.com/salesforce-apex-coding-visualforce-designing-for-beginners/

https://resources.docs.salesforce.com/sfdc/pdf/salesforce_apex_language_reference.pdf

https://developer.salesforce.com/page/Apex

https://developer.salesforce.com/page/An_Introduction_to_Apex


Please do let me know if it helps you.

Regards,
Mahesh
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

Thanks
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.

https://developer.salesforce.com/trailhead/module/apex_database



Hope this helps you!
Best Regards,
Jyothsna