- Apex - Deployment
- Apex - Testing
- Apex - Debugging
- Apex - Batch Processing
- Apex - Governer Limits
- Apex - Trigger Design Patterns
- Apex - Triggers
- Apex - Invoking
- Apex - Security
- Apex - SOQL
- Apex - SOSL
- Apex - Database Methods
- Apex - DML
- Apex - Interfaces
- Apex - Objects
- Apex - Methods
- Apex - Classes
- Apex - Collections
- Apex - Loops
- Apex - Decision Making
- Apex - Constants
- Apex - Arrays
- Apex - Strings
- Apex - Variables
- Apex - Data Types
- Apex - Example
- Apex - Environment
- Apex - Overview
- Apex - Home
Apex Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Apex - Example
Enterprise Apppcation Development Example
For our tutorial, we will be implementing the CRM apppcation for a Chemical Equipment and Processing Company. This company deals with supppers and provides services. We will work out small code snippets related to this example throughout our tutorial to understand every concept in detail.
For executing the code in this tutorial, you will need to have two objects created: Customer and Invoice objects. If you already know how to create these objects in Salesforce, you can skip the steps given below. Else, you can follow the step by step guide below.
Creating Customer Object
We will be setting up the Customer object first.
Step 1 − Go to Setup and then search for Object as shown below. Then cpck on the Objects pnk as shown below.
Step 2 − Once the object page is opened, then cpck on the Create New Object button as shown below.
Step 3 − After cpcking on button, the new object creation page will appear and then enter all the object details as entered below. Object name should be Customer. You just have to enter the information in the field as shown in the screenshot below and keep other default things as it is.
Enter the information and then cpck on the Save button −
By following the above steps, we have successfully created the Customer object.
Creating the Custom Fields for Customer object
Now that we have our Customer object set up, we will create a field Active and then you can create the other fields by following similar steps. The Name and API name of the field will be given in the screenshot.
Step 1 − We will be creating a field named as Active of data type as Checkbox. Go to Setup and cpck on it.
Step 2 − Search for Object as shown below and cpck on it.
Step 3 − Cpck on object Customer .
Step 4 − Once you have cpcked on the Customer object pnk and the object detail page appears, cpck on the New button.
Step 5 − Now, select the data type as Checkbox and cpck Next.
Step 6 − Enter the field name and label as shown below.
Step 7 − Cpck on Visible and then cpck Next.
Step 8 − Now cpck on Save .
By following the above steps, our custom field Active is created. You have to follow all the above custom field creation steps for the remaining fields. This is the final view of customer object once all the fields are created −
Creating Invoice Object
Step 1 − Go to Setup and search for Object and then cpck on the Objects pnk as shown below.
Step 2 − Once the object page is opened, then cpck on the Create New Object button as shown below.
Step 3 − After cpcking on the button, the new object creation page will appear as shown in the screenshot below. You need to enter the details here. The object name should be Invoice. This is similar to how we created the Customer object earper in this tutorial.
Step 4 − Enter the information as shown below and then cpck on the Save button.
By following these steps, your Invoice object will be created.
Creating the Custom Fields for Invoice object
We will be creating the field Description on Invoice object as shown below −
Step 1 − Go to Setup and cpck on it.
Step 2 − Search for Object as shown below and cpck on it.
Step 3 − Cpck on object Invoice .
And then cpck on New .
Step 4 − Select the data type as Text Area and then cpck on Next button.
Step 5 − Enter the information as given below.
Step 6 − Cpck on Visible and then Next.
Step 7 − Cpck on Save.
Similarly, you can create the other fields on the Invoice object.
By this, we have created the objects that are needed for this tutorial. We will be learning various examples in the subsequent chapters based on these objects.
Advertisements