Salesforce – Records, Fields and Tables We have already seen how to get the values of a record using the standard controller. But we can also display the field values in a more formatted way by using additional controllers. In this chapter, we will see how to display the fields of an object and the data of a details table in a Master-detail relation. Display Fields When we want to display the fields of a record in a formatted manner with column headers, rather than just the labels and values, we can use the OutputField option. The code given below shows the apex program to display the filled data from Contact. As you can see, we do not need the labels to be in place to indicate the field values. To preview the result of the above code, we use the ID of the record as described in the previous chapter. The result shows the following output showing the field values of the records along with column headers. Display Tables We can display all the records of a details table by taking a value from a master table. For example, we can display all the contacts associated with an account. In such case, we use the iteration component which in our case is the contacts table linked to account. Below is the code to display all the contacts associated with the Account table. On previewing the output form the above code, we get the following result.
Category: salesforce
Salesforce – Useful Resources The following resources contain additional information on Salesforce. Please use them to get more in-depth knowledge on this topic. Useful Video Courses 50 Lectures 3.5 hours 29 Lectures 4.5 hours 13 Lectures 10 hours 46 Lectures 5.5 hours 12 Lectures 10.5 hours 43 Lectures 8.5 hours
Discuss Salesforce Salesforce is a leading CRM (Customer Relationship Management) software which is served form cloud. It has more than 800 applications to support various features like generating new leads, acquiring new leads, increasing sales and closing the deals. It is designed to manage the organization”s data focused on customer and sales details. It also offers features to customize its inbuilt data structures and GUI to suit the specific needs of a business. More recently, it has started offering the IOT (internet of things) connectivity to the CRM platform.
Salesforce – Quick Guide Salesforce – Overview Salesforce started as a cloud based solution for CRM. CRM stands for Customer Relationship Management. It involves managing all aspects of relationship between an organization and its customers. For example, the contact details of the customer, the deals that are in progress or already completed, the support requests from a customer or a new lead from a new customer. Beyond the customer related information, it also involves storing and managing the details of the people and the concerned department from the seller organization that is managing the customer’s account and needs. This makes it easy to manage and enhance the relationship with the customer and hence better growth for the organization. Following are the different features of the Salesforce platform − Contact Management To view customer contact details, activity history, customer communications, and internal account discussions, etc. In short, it manages all the data pertaining to the contact with a customer. Opportunity Management It provides the details of the stage a deal is in, the products involved in the deal, the quotation for the deal etc. In short it manages all the data that helps in identifying, progressing and closing a deal. Salesforce Engage This feature is focused on making personalized contact with a customer for various campaigns designed by the marketing team. It also provides real-time sales alerts based on the level of engagement with a customer. Sales Collaboration This feature helps in quickly finding experts who can help in closing a deal based on customer queries and feedback. In short, it helps in bringing in a collaborative effort to engage an entire team in the deal and make the deal happen. Sales Performance Management It provides a metric-based goal setting, and also continuous feedback and rewards and recognition for the sales team. This helps in enhancing the performance of the sales team. Lead Management This feature initiates and tracks the leads that are in progress. It also helps in continually optimizing campaigns across every channel. Partner Management This feature helps in building a community with partners. It also helps in connecting directly with channel partners to share goals, objectives, and activities. Salesforce Mobile App This is the mobile platform to carry out all the above activities on a mobile platform. Workflow and Approvals It is a visual design to automate the business processes. The interface provides simple drag and drop options to make this design. It helps in creating a flexible approval process with deal discounts and expense management etc. Email Integration Salesforce can integrate to an existing email platform. This helps in providing flexibility to the existing team with no additional learning curve. Files Sync and Share This feature provides the sales team the power to easily share various files, discuss them and update them as needed. Also receive alerts when something in the file changes. Reports and Dashboards Dashboards offer a real-time picture of the business at a glance. With this, anyone can create detailed reports which can be accessed from anywhere. Sales Forecasting This feature helps in getting a real time view of the forecast of a sales team. It provides multi-currency support and an in-line editing mode to manage the sales forecast well. Territory Management This feature is used to create multiple territory models, preview them before rollout, and continually optimize and balance territories throughout the year. Salesforce – Architecture Salesforce delivers a highly customized experience to the customers, employees, and partners of an organization. Such a platform is used to customize standard functionality and create custom pages, components, apps, etc. Also it is done faster, mainly because of the superb architecture on which it is built. Below is a brief introduction to the Salesforce Architecture. Architecture Salesforce The architecture of Salesforce can be put into layers for better understanding. The purpose and function of each layer is described below − Trusted Multitenant Cloud Here multiple instances of one or multiple applications operate independently in a shared environment. The instances are referred as tenants and they logically separate from each other while physically remaining in the same hardware. It is called trusted because of both its robust nature and high security. Scalable Metadata Platform The metadata driven platform makes it easy for customization and scaling up as the amount of data or concurrent user instances increase. Enterprise Ecosystem The Enterprise Ecosystem of Sales is very large as a large number of partners contribute by creating and maintaining applications in this platform. CRM and Related Functionality Salesforce includes all aspects of CRM in its list of features and also extends it by providing features for creation of apps and integrating analytics, etc. APIs Salesforce provides powerful suite of APIs. This helps to develop and customize the Salesforce1 Mobile App. Salesforce – Environment As Salesforce is a cloud based system it does not need any software installation on your part. All you have to do is signup for a free trial and get started. The free trial account provides nearly all features which you need to learn to understand the basics of Salesforce platform. Let us now discuss the steps to get started with the Salesforce environment. Step 1 Go to the link and click on Free Trial. It takes you to a window where you have to fill in some details about you and sign up. Step 2 You will receive an activation mail for your account which also contains the details of your account and the duration of the trial period. Click on the link in the email to verify your email ID and activate the account. Step 3 Again visit the link and click on login. Give the login credentials which you just created. You will be directed to the following screen. You are ready to learn as your environment is set up now. You may click on Take Tour of Salesforce to familiarize yourself with the user interface. Salesforce – Sales Cloud Sales Cloud part of the Salesforce.com platform which is focused on enhancing
Salesforce – Static Resources The user interface in a Visualforce base can display dynamic content the value of which keeps changing based on user responses. But there are times when we need some content which should not change with the change in values of other components in the page. For example, an image file may be required to remain constant. Such content which cannot be changed in a page is known as a static resource. Following are a few static resources in Salesforce − Images Javascript Files Flash files CSS files The steps to create a static resource are as below. Create a Static Resource container Go to Develop → Static resource and mention the values for name, description and file location for the static resource. Upload a Static Resource Click Save in the above screen to get the file attached to the User Interface controller. Reference the Static Resource Next we create the apex code as in the following screenshot to reference the static object we created above. Output Running the above apex code will generate the following output. The output shows a static resource.
Salesforce – Variables & Formulas The data from the Salesforce objects can be brought into the Visualforce page using variables and expressions. Like other normal programming language, the Visualforce language has expressions, operators and literals, etc. The basic building block of this language is expressions. The syntax of a Visualforce expression is as below. {! expression } Example Let us use the global variable $user. We can write the following code to get the username, First name and login name. On previewing the output, we get the following details. Similarly, we can use many other variables and manipulate them using formula as shown in the code below. On previewing the output, we get the following details.
Salesforce – Standard Controllers Visualforce consists of many built-in controllers which can be used to access and display data. It works on the MVC (model-view-controller) approach. The controllers interact with the database and pull the data from the database to view the data through a webpage created by apex page. To display a specific record or group of records, we need the record ID. When integrated with other Visualforce pages the ID can flow to the controller page automatically. But in a standalone page we need to specify the record ID manually to see the controller working. Example Let us create a Visualforce page to get the summary of a record in the Contact object. To do this, we use the component called standardController and put it in an apex block. The diagram given below shows the code to achieve this. Here we display some select fields from the Object. They are Name, Email and phone. If we go to the Preview window, we find that the page only displays the labels but no data. That is because we have not associated the result from the controller with any specific record. So next we identify a record form the Contact Object to be attached to the result from the controller. Open the contacts object and click on any of contact name. It will open the following window from which we capture the ID of the record. The ID is highlighted in the URL. In your environment, it will be a similar string of characters. Finally, we add this ID of the record to the URL of the preview window of the Visualforce standard controller page we created. In the current example, the ID of the record is added as shown below. https://c.ap2.visual.force.com/apex/FirstPage?core.apexpages.request.devconsole=1&id=0032800000Wih9kAAB On visiting the above URL from the Organization”s salesforce account, we get the details of the record as shown below.
Salesforce – List Controllers In this chapter, we will discuss List Controllers in Salesforce. At times, we need to view a given set of records from a Salesforce object by applying filter criteria. This is achieved by using list controllers which allow you to create Visualforce pages that can display or act on a set of records. The standard list controllers can be used in the following set of objects. Account Asset Campaign Case Contact Contract Idea Lead Opportunity Order Solution User Custom objects Example We take the example of contact object. We fetch the records from this object and display it using list controllers. To achieve this, we create an apex page with the following code. The code creates a pageblock with column values matching the column names of the contact object. Upon running the above code, we receive the following output.
Salesforce – Using Forms Salesforce is a data-driven platform. So viewing and editing data in its apps is a fundamental requirement. Like the traditional HTML forms, we can create similar forms in Saleforce for editing the data in Salesforce. Creating Input Form The Input forms are created using a Visualforce page. We open a new Visualforce page by using the path Developer Console → File → New → Visualforce Page. We write the code as shown below which uses Contact as the standard controller and the purpose is to edit the values in the 3 fields – Name, Email and Phone. Upon running the above code for the visualforce page, we get the following output.. But we can improve the above form further by aligning the fields to one column and putting all the input fields and labels into a block. The code given below shows how we add a section and block to the form and also put the fields in one column. Upon running the above code for the Visualforce page, we receive the following output.
Salesforce – Using Formula Fields Many times we need to manipulate the values of the fields stored in the Salesforce object by applying a few conditions or calculations. For example, we need to get the Account number value linked to the contact object, so that we can find the Account number from the contact name. In such scenarios, we create formula field in addition to the existing fields in the object. Let us now see the steps to create formula field. Step 1 Go to the link path Setup Home → Object Manager → Contact. Then scroll down to the Fields and Relations tab and add New. Choose Formula as the data type and click Next. The following window appears. Here we choose the return type as Text and also fill in the Field Name and Field Label. Step 2 Clicking on Next brings takes you to the next window wherein, you have to select the field based on which the formula will be built. Let us now choose Account number from the Account table. Click Insert to insert this field into the Contact object. Step 3 In this step, we can see the field Account Number appear under the fields of the Contact object as shown below.