পৃষ্ঠাসমূহ

.

Search Your Article

Total Pageviews

Wednesday, January 25, 2017

Apex - Example

Enterprise Application Development Example

For our tutorial, we will be implementing the CRM application for a Chemical Equipment and Processing company. This company deals with suppliers and provides services. We will work out small code snippets related to this example throughout our tutorial to understand every concept deeply.

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 below steps. 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 click on the Objects link as shown below:
customer_object_creation_step_1
customer_object_creation_step_1_2
Step 2: Once the object page is opened, then click on the 'Create New Object' button as shown below:
customer_object_creation_step_3
Step 3: After clicking on button, 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 below screenshot and keep other default things as it is.
customer_object_creation_step_4
Enter the information and then click on 'Save' button:
customer_object_creation_step_5
By following 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 could 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 click on it.
customer_custom_field_creation_step_1
Step 2: Search for 'Object' as shown below and click on it:
customer_custom_field_creation_step_2
Step 3: Click on object 'Customer':
customer_custom_field_creation_step_3
Step 4: Once you have clicked on Customer object link and the object detail page appears, click on the New button:
customer_custom_field_creation_step_4
Step 5: Then select the data type as Checkbox and click next:
customer_custom_field_creation_step_5
Step 6: Enter the field name and label as shown below:
customer_custom_field_creation_step_6
Step 7: Click on Visible and then click Next:
customer_custom_field_creation_step_7
Click on 'Save'.
customer_custom_field_creation_step_8
By following above steps, our custom field 'Active' is created. You have to follow all above custom field creation steps for remaining fields. This is the final view of customer object once all field are created:
final_view_customer_object

Creating Invoice Object

Step 1: Go to Setup and search for 'Object' and then click on the Objects link as shown below:
invoice_object_creation_step_1
invoice_object_creation_step_2
Step 2: Once the object page is opened, then click on the 'Create New Object' button as shown below:
customer_object_creation_step_3
Step 3: After clicking on button, new object creation page will appear as shown below and then enter all the object details as entered below. Object name should be Invoice. This is similar to how we created the Customer object earlier in this tutorial.
customer_object_creation_step_4
Enter the information as shown below and then click on 'Save' button:
invoice_object_creation_step_5
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 click on it.
customer_object_creation_step_1
Step 2: Search for 'Object' as shown below and click on it:
customer_object_creation_step_1_2
Step 3: Click on object 'Invoice'.
invoice_custom_field_creation_step_3
And then click on 'New'.
invoice_custom_field_creation_step_4
Step 4: Select data type as Text Area and then click on Next button.
invoice_custom_field_creation_step_5
Step 5: Enter information as given below:
invoice_custom_field_creation_step_6
Step 6: Click on Visible and then next:
invoice_custom_field_creation_step_7
And then click on Save.
invoice_custom_field_creation_step_8
Similarly, you can create the other fields on the Invoice object.
final_invoice_object_view
By this, we have created the objects that are needed for following through the tutorial. We will be learning various examples in the further chapters based on these objects.

No comments:

Post a Comment