Salesforce Apex

Introduction

Apex is a programing language developed by Salesforce.com. It is a proprietary language i.e., only used to execute in the force.com platform. In this article, we will learn about writing apex, running apex, debugging, testing, and deploying apex. It seems to be little different compared to the conventional processes.

What is Salesforce Apex?

Salesforce Apex is a strongly typed, Object-oriented language much similar to Java. In apex, it has a few additional features to support salesforce functionalities properly. Apex is directly integrated with the salesforce databases, so you can directly perform DML operations which is very convenient.

Writing Apex

As Apex is almost similar to Java, Knowledge of java is enough to write apex code in just a few days effectively. It has if –else, switch and loop concepts and the execution occurs line by line like in java. We just need additional basic knowledge on salesforce to write a full-fledged code in apex.

Running Apex

We can run apex on the salesforce platform to access the entire interface programmatically.

Call Apex:

Apex can be called using triggers, asynchronously or by using integrations like SOAP or REST services.

Governor Limits:

The entire code should be within governor limits for the proper utilization of the resources as salesforce uses the multi-tenet architecture.

Integrated with Databases:

By using apex one can perform all the DML operations directly as it is integrated with the salesforce databases.

Debugging, Testing, and Deploying Apex

Well, this is the most interesting concept with the developer console.

Debugging:

In the developer console, you have debug logs where you can debug the code very efficiently. You surely get the beauty of it once you go hands on with it.

Testing:

Testing in apex is done by writing 100% code coverage unit tests where you can completely test the code and get it ready for execution.

Deploying Apex

Well, it’s not possible to deploy the apex code in a production org, but you can do that work using developer or sandbox.

Apex Code can be deployed using the VS Code with Salesforce DX plug-ins, Change sets and The Ant Migration Tool, etc.

References:

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

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

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.