In the previous chapter we saw the object database behind Force.com. A robust system is one that separates the view from the model. In the model, we have now created objects and created relationships between the objects. The objects that we created in the last chapter need an equally rich UI for users to fill data. They need placeholders and visual indicators to collect this data and the information.
As with the tradition of Force.com, most of the things are point-and-click. Similarly, in this chapter we will be using point-and-click controls to create some important page layouts and UI designs.
By the end of this chapter, you will be able to:
The Salesforce Developer Certification requires us to have an overview of Apex and Visualforce; hence we will be covering only the basics of the Visualforce in this chapter and the basics of Apex in the next.
So let's start creating some amazing user interfaces...
An application or an app is a collection of tabs and objects used together to form a business process. Different tabs and objects are grouped together to form a single business unit for user convenience.
The following screenshot indicates the standard application provided by Salesforce.com by default:
Salesforce provides standard applications such as Sales, Call Center, Marketing, Community, and Force.com.
We can customize an application by giving it a custom logo, a custom name, a custom description, and a custom landing page. We can give the instructions to use the objects on the custom landing page.
All custom applications display the standard Salesforce logo. The logo can be replaced with a custom logo.
The custom logo can be any GIF and JPG file from the Documents tab.
We add the tabs that should be included in the application, for example, in the application of library management we include tabs, media, customer and so on.
The default landing tab can be selected here on the screen. The last step of the application creation wizard is assigning the profiles to the application; we will discuss this later.
Let's continue building the Library Management System. Build an application for the Library Management System. Design a simple custom logo for the same.
To build your own application perform the following steps:
A custom tab is used to display object data or other contents embedded in the application. The custom tab has a unique tab style. We can choose the color and icon for the tab.
The following screenshot shows the different types of tabs:
We cannot create tabs for standard objects. The Standard Object Tabs can be hidden/ shown and added to any custom application. There are three types of custom tabs:
In the Library Management System, we have so far created different objects to collect data on media and customers. The general library wants to collect people's information using the web interface. They require tabs to store this information.
Create object tabs for all the objects created in Chapter 2, Creating a Database on Force.com. To create a custom object tab follow the instructions:
Page layouts are needed to display the data collected in the system. Most of the page layouts are highly customizable while others are very poorly customizable. Page layouts can also be assigned to particular users or a type of record that is Internet. We will be looking into record type and page layout in Chapter 4, Implementing Business Logic. Every object on Force.com has a minimum of three separate page layouts:
We will be looking into the layout editor in detail in the coming chapter.
The page layout editor is used in the organization of the Fields, Custom S-Controls, and Related Lists on a detail page layout. The fields that are editable are automatically available in the edit page layout.
To open the page layout editor go to Setup | Create | Objects | Custom Object name | Page Layouts.
Normally, every object will be assigned a single default page layout that is accessible to all the people. Some standard objects have multiple page layouts. To modify a page layout make sure you identify which profile the page layout is accessible to prevent data visibility problems. The following screenshot shows the enhanced page layout editor:
Some salient features of the editor are as follows:
1 |
We can select other layouts to edit quickly. |
2 |
The modified layout can also be saved in a different name. |
3 |
We can select between Fields, Buttons, and Related Lists. |
4 |
With the layout properties, we can change the name of the layout and make it user friendly and understandable. |
5 |
Fields, buttons and layouts are available for adding on the page. Already used objects are disabled. |
6 |
The highlights are used for consoles we will discuss this later in further chapters. |
7 |
Buttons can be added only in the custom buttons slot and are not available on the edit page layout. |
8 |
Lock indicates the field is locked from being removed on the page layout. These fields cannot be removed from a page layout. |
9 |
Fields can be organized and grouped together in sections. A section can have a single column or a double column. |
10 |
We can add custom links to the records in this part of the page layout. |
11 |
Related lists are added only in the records having a lookup relationship and a master detail relationship with other objects. |
12 |
Additional properties on the related list can be edited by clicking on the wrench symbol. We can add/remove fields from the child object to be displayed on the page of the master object using this. |
Apart from adding the fields and buttons, the advance page layout editor also helps us group different fields in sections and add blank spaces for alignment. The following screenshot shows the Section and Blank Space in the editor:
Let us the look into these two options one after another:
A section can have a single column or two-column layout. We also get the option for the Tab-Key Order in a section.
The general library is filling information in the Media object that we have created previously.
However, the fields are spread across the page and the users are finding it difficult to fill in the information. Group the fields in a logical grouping on the page layout editor. Some fields are different for books and videos.
Create two separate layouts, one for books (with ISBN number) and one for videos (with title and year).
We can add the custom buttons and links to the record. Buttons and links have actions attached to them referring to the functionality they are achieving. For example, a Save button saves the data filled in the application to the server. The buttons are also differentiated based on their placement on the application.
There are three types of buttons available:
Buttons cannot be added on the edit page of the record.
To create a new button, perform the following steps:
After we create the button we again go back to the advance page layout editor to add the button on the page.
When we are adding fields on the page layout they can be made Required or Read-Only by setting their properties. The Field Properties dialogue box shown in the next screenshot can be accessed by clicking the wrench symbol on the desired field:
As shown in the screenshot we can set the field to be Required or Read-Only on the page layout. As mentioned in the previous chapter, if the field is not universally required (set as required during the creation of the field) it can be made required on the page layout.
It should, however, be noted here that the field marked as required here will be required only on this page layout, it will not be required if the data is filled from the back-end or through API or any other page layout. This option is useful if we have a single page layout that requires this field.
We can also set the field as read-only in the same option, the field appears uneditable on the page only and the user can still fill the value from other page layouts or theback-end.
The advanced page layout editor only helps in editing the detail page of the record. Force.com does not allow us to modify the edit page for the record. Edit page layout assumes the same pattern as the detail page layout only the editable fields are displayed with a Save button.
Apart from that Force.com gives us the option to modify other layout such as the lookup layout (choosing which fields to show when lookup for the object is clicked) or the tab layout. Let's edit the Media Lookup layout as an example:
We can add a custom list button to the search results and media list view. On the other layout, we can only select which fields are to be displayed on screen.
Similarly we can customize the other layouts for the object too.
We can define mini page layouts for the records that appear in the mini view of the Console tab, hover details, and event overlays. A Mini Page Layout contains a subset of the items in an existing page layout. Mini page layouts inherit record type and profile associations, related lists, fields, and field access settings from their associated page layout.
The visible fields and related lists of the Mini Page Layout can be further customized, but the other items inherited from the associated page layout cannot be changed on the Mini Page Layout itself.
To create a Mini Page Layout, click on Setup | Create | Object Name | Page Layout. Click on Mini Page Layout on the green bar on top.
Just like Search Layout, the Mini Page Layout, and the mini console layout gives us the option of the field names that can be added to the layout.
This completes the page layouts and the visual point and click features of Force.com.
The Salesforce Certified Developer program gives an overview of what Visualforce can offer and the basic tags used in it. The following section will give a brief overview of Visualforce, we won't be going deep into coding.
Let's start with it.