0% found this document useful (0 votes)
3 views8 pages

Practical Assignment 4 Cloud Computing

The document outlines a practical assignment focused on creating an application in Salesforce.com using the Apex programming language. It covers objectives, hardware and software requirements, and provides an overview of Apex, including its syntax, applications, and development tools. The assignment concludes with instructions on executing code in the Developer Console.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Practical Assignment 4 Cloud Computing

The document outlines a practical assignment focused on creating an application in Salesforce.com using the Apex programming language. It covers objectives, hardware and software requirements, and provides an overview of Apex, including its syntax, applications, and development tools. The assignment concludes with instructions on executing code in the Developer Console.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Practical Assignment 4 Cloud Computing

Title: Creating an Application in SalesForce.com using Apex programming Language

Objectives:

●​ To learn salesforce cloud administration

●​ To create application in SalesForce.com using Apex programming

Hardware Requirements :

●​ Pentium IV with latest configuration

Software Requirements :

●​ Ubuntu 20.04, Web application i.e. salesforce.com

Theory:

What is Apex?
Apex is a proprietary language developed by Salesforce.com. As per the official definition, Apex is a
strongly typed, object-oriented programming language that allows developers to execute the flow
and transaction control statements on the Force.com platform server in conjunction with calls to the
Force.com API.
It has a Java-like syntax and acts like database stored procedures. It enables the 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 is
included in Performance Edition, Unlimited Edition, Enterprise Edition, and Developer Edition.
Apex Applications
We can use Apex when we want to −
❖​ Create Web services with integrating other systems.
❖​ Create email services for email blast or email setup.
❖​ Perform complex validation over multiple objects at the same time and also custom
validation implementation.
❖​ Create complex business processes that are not supported by existing workflow functionality
or flows.
❖​ Create custom transactional logic (logic that occurs over the entire transaction, not just with a
single record or object) like using the Database methods for updating the records.
❖​ Perform some logic when a record is modified or modify the related object's record when
there is some event which has caused the trigger to fire.
Working Structure of Apex
As shown in the diagram below (Reference: Salesforce Developer Documentation), Apex runs
entirely on demand Force.com Platform
Understanding the Apex Syntax
Apex code typically contains many things that we might be familiar with from other programming
languages.
Variable Declaration
As strongly typed language, you must declare every variable with data type in Apex. As seen in the
code below (screenshot below), lstAcc is declared with data type as List of Accounts.
SOQL Query
This will be used to fetch the data from Salesforce database. The query shown in screenshot below
is fetching data from Account object.
Loop Statement
This loop statement is used for iterating over a list or iterating over a piece of code for a specified
number of times. In the code shown in the screenshot below, iteration will be same as the number of
records we have.
Flow Control Statement
The If statement is used for flow control in this code. Based on certain condition, it is decided
whether to go for execution or to stop the execution of the particular piece of code. For example, in
the code shown below, it is checking whether the list is empty or it contains records.
DML Statement
Performs the records insert, update, upsert, delete operation on the records in database. For
example, the code given below helps in updating Accounts with new field value.
Following is an example of how an Apex code snippet will look like. We are going to study all these
Apex programming concepts further in this tutorial.
Apex Code Development Tools
In all the editions, we can use any of the following three tools to develop the code −
​Force.com Developer Console
​Force.com IDE
​Code Editor in the Salesforce User Interface
Force.com Developer Console
The Developer Console is an integrated development environment with a collection of tools you can
use to create, debug, and test applications in your Salesforce organization.
Follow these steps to open the Developer Console −
Step 1 − Go to Name → Developer Console

Step 2 − Click on "Developer Console" and a window will appear as in the following screenshot.
Following are a few operations that can be performed using the Developer Console.

​Writing and compiling code − You can write the code using the source code editor. When you save
a trigger or class, the code is automatically compiled. Any compilation errors will be reported.

​Debugging − You can write the code using the source code editor. When you save a trigger or class,
the code is automatically compiled. Any compilation errors will be reported.

​Testing − You can view debug logs and set checkpoints that aid in debugging.

​Checking performance − You can execute tests of specific test classes or all classes in your
organization, and you can view test results. Also, you can inspect code coverage.

​SOQL queries − You can inspect debug logs to locate performance bottlenecks.

​Color coding and autocomplete − The source code editor uses a color scheme for easier readability
of code elements and provides auto completion for class and method names.
Executing Code in Developer Console
All the code snippets mentioned in this tutorial need to be executed in the developer console. Follow
these steps to execute steps in Developer Console.
Step 1 − Login to the Salesforce.com using login.salesforce.com. Copy the code snippets mentioned
in the tutorial. For now, we will use the following sample code.
String myString = 'MyString';
System.debug('Value of String Variable'+myString);
Step 2 − To open the Developer Console, click on Name → Developer Console and then click on
Execute Anonymous as shown below.

Step 3 − In this step, a window will appear and you can paste the code there.
Step 4 − When we click on Execute, the debug logs will open. Once the log appears in window as
shown below, then click on the log record.

Then type 'USER' in the window as shown below and the output statement will appear in the debug
window. This 'USER' statement is used for filtering the output.
Conclusion:

Thus, We have created an Application in SalesForce.com using Apex programming Language.

You might also like