© Rakesh Gupta 2020
R. GuptaSalesforce Platform App Builder Certificationhttps://doi.org/10.1007/978-1-4842-5479-0_5

5. Improving and Enriching Data Quality

Rakesh Gupta1 
(1)
Katihar, India
 

In Chapter 4, we looked at an overview of Lightning Experience and studied the dynamic record page. Last, we discussed use cases for custom buttons, links, and actions using real-life examples.

This chapter is comprised of two parts. The first part is divided into two sections; part two is divided into three sections.

In part one, the first section consists of an overview of record types; the second section takes a look at lookup filters and dependent lookups.

In part two, the first section consists of an overview of formula fields, the second section discusses a use case of a roll-up summary field, and the last section examines the best way to write enterprise-level validation rules using custom permissions.

Record Types: A Better Way to Handle Varied Business Processes

Record types play a key role in Salesforce implementation. Without having a good understanding of them, developers or architects may end up devising an incorrect solution or writing code, which may turn out to be a suboptimal solution.

For example, suppose there is a custom object Registrant that is being used to store event participants. Depending on the value in the Industry field, a marketing director wants to display different fields on a page layout, as shown in Table 5-1. If the value in the Industry field is Manufacturing, then the director wants to display additional fields on a page layout, such as Annual Income, Date of Birth, or Shift Hours. If, however, the value in the Industry field is anything other than Manufacturing, the director does not want to display the additional fields.
Table 5-1

Representation the Data Marketing Director Wants to Capture

Manufacturing

Other

First Name

Last NameE-mailEventIndustry (Manufacturing, Shipping, Consulting, and Other)

PhoneAnnual Income*Date of Birth*

Shift Hours*

First Name

Last NameE-mailEventIndustry (Manufacturing, Shipping, Consulting, and Other)

Phone

Now there are various ways to meet this requirement. For example, we can write validation rules that state that whenever the value in the Industry field is Manufacturing, make the three other fields required. This requires users to populate the fields before they can save the record.

Even if the validation rule works, it will create a negative user experience because the required fields, as a result of the value Manufacturing in the Industry field, would not have red asterisk attached to it.

Figure 5-1 demonstrates how developers can make fields required based on the value in the Industry field . The aforementioned approach (Figure 5-1) has the following issues:
  1. 1.

    Right off the bat, it creates a negative user experience because the required fields (only when the value in the Industry field is Manufacturing) would not display a red asterisk next to it!

     
  2. 2.

    Second, what happens if users select a value other than Manufacturing in the Industry field? In such a scenario, they would be able to skip entering the data in the aforementioned required fields because the validation rule would not trigger if the value in the Industry field is anything other than Manufacturing. This situation creates a big dent in achieving, and maintaining, data integrity—to say the least!

    To avoid a negative user experience or avoid compromising data integrity, developers and architects have to write a complex validation rule.

     
  3. 3.

    The validation rule route displays unnecessary fields on a page layout when a value other than Manufacturing is in the Industry field. In such a scenario, fields like Annual Income, Date of Birth, or Shift Hours would gobble up page layout real estate without adding any value—not to mention delivering a suboptimal user experience.

     
  4. 4.

    Last but not least, with the validation rules route, confusion, a negative user experience, and clutter in the page layout skyrockets if developers or architects are tasked with adding a few custom buttons or links to the page layout specific to the manufacturing industry!

     
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig1_HTML.jpg
Figure 5-1

Required fields based on the Industry drop-down

Still not convinced the validation rules route may be a suboptimal solution? Well then, let us take a look at another example.

Assume the marketing director is happy with the validation rules solution you provided, and that it works as of today. However, the director now walks into your office and tasks you with a new requirement: she wants the value in the Industry field to be Shipping. When the value in the Industry field is Shipping, you need to create more than 40 fields. The marketing director also wants to gather additional data, such as participants’ current job duties and bonuses, when the value is Shipping. To avoid confusion, a negative user experience, and clutter in the page layout, the director does not want the 40 fields to be displayed if the value in the Industry field is not Shipping.

In light of this situation, do you still think the validation rules route is an optimal solution? I don’t think so either. To conclude, because page layout doesn’t allow users to show/hide fields based on the value of another field, the validation rules route falls short. Developing a solution for the various scenarios just described requires developers and architects to use record types as an option.

What Are Record Types?

Record types allow you to group similar fields and display them to users as necessary. They do so by enabling you to segment a particular object’s fields/sections for specific uses.

Figure 5-2 demonstrates how a page layout is organized in different sections. Think of the Opportunity page layout as a large box that contains multiple compartments. The same page is displayed to all sales reps at every stage of a deal, regardless of whether the sales reps have use for all the fields on the page layout. As we saw earlier, this affects productivity and the sales reps’ experience negatively.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig2_HTML.png
Figure 5-2

A page layout is organized in different sections

Record types to rescue! Record types help improve the sales rep experience by displaying appropriate sections/fields on a page layout based on an Opportunity stage .

Record types are used mainly for two purposes:
  1. 1.

    To show different page layouts based on conditions. For example, if an Opportunity stage is Closed Won or Closed Lost, then, display the Read Only page layout.

     
  2. 2.
    To show/hide picklist values. For example, if an Opportunity type is Existing business, then remove the following values from the Lead Source field:
    • Partner

    • Employee Referral

    • Other

     

As a developer, you can create three different page layouts—Discovery, Billing, and Shipping—then display different fields on the page layout based on the value in the Opportunity stage field.

Table 5-2 represents the page layouts and their dependency based on the Opportunity stage. To control fields in page layouts based on the Opportunity stage, you need to use a record type.
Table 5-2

Page Layouts and Their Dependency on the Opportunity Stage

Page Layout

Stage

Discovery

Prospecting

Billing

Proposal/Price Quote

Shipping

Closed Won

Figure 5-3 demonstrates how record types control page layouts based on different stages. One record type can assign different page layouts to different profiles, or one record type can assign a single page layout to multiple profiles. In Figure 5-3, record type controls discovery page layouts 1 and 2 based on the profiles. So far so good. Let’s take this discussion one level up.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig3_HTML.jpg
Figure 5-3

Record types control page layouts

Let’s get back to our business scenario with Robin Guzman. He’s received a request from his manager to configure the Registrant custom object based on Table 5-1.

He performs the following steps to meet this requirement using record types and page layouts:
  1. 1.

    Robin navigates to Setup (gear icon) ➤ SetupObject ManagerCreateCustom Object and creates a new custom object, Registrant, and all the fields mentioned in Table 5-1.

     
  2. 2.

    Next, he creates two page layouts by navigating to Setup (gear icon) ➤ SetupObject ManagerRegistrantPage Layouts.

     
The Registrant page layout should look like Figure 5-4.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig4_HTML.jpg
Figure 5-4

Registrant page layout

The Manufacturing Registrant page layout should look like Figure 5-5.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig5_HTML.jpg
Figure 5-5

Registrant page layout for manufacturing

  1. 3.

    Last, Robin creates two record types—Manufacturing and Others—and then assigns page layouts as shown in Figure 5-6.

     
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig6_HTML.jpg
Figure 5-6

Assigning page layouts based on record types and profiles

Going forward, users will get an option to select the record type before creating a Registrant record, as shown in Figure 5-7. Based on the record type, it will display the page layout.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig7_HTML.jpg
Figure 5-7

Option to select a record type

How Record Types Control Lightning Record Pages

I have seen many questions from people, as part of the Trailblazer Community, wondering how record types and page layouts are connected in Lightning record pages. Here is my answer: a record type can control both page layout and Lightning record pages at the same time, because they are separate components.

Still confused on how record types control Lightning pages and page layouts? Well, let me show you an architectural diagram (Figure 5-8) that displays the connections among record types, Lightning record pages, and page layouts.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig8_HTML.jpg
Figure 5-8

How record type controls Lightning record pages and page layouts

Figure 5-8 also shows that users in two different profiles can not only have the same page layout, but also they can have different Lightning record pages configured for their profiles—and vice versa!

Basically, in Lightning Experience, you use Classic page layout as a component (Record Detail), which sits on top of the Lightning record page. This means both are separate Lightning components. Therefore, both are configurable at the object level.

After you create a Lightning record page, click the Activation button to assign the Lightning record page based on record types and profiles.

Figure 5-9 demonstrates how you can assign a Lightning record page to record types and profiles in Lightning App Builder.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig9_HTML.jpg
Figure 5-9

Assigning a Lightning record page to record types and profiles

Lookup Filter: Limit the Records That Can Be Shown in a Lookup Window

A lookup filter is one of the best tools to enrich data quality by enforcing data consistency. The filters limit fields and values displayed in a lookup dialog and, as a result, enforce access to valid values. The filter can be used when objects are in a lookup, master detail, or hierarchical relationship.

Let’s look at an example. Pamela Kline has been given the requirement to restrict the Account Name field on opportunities by only allowing accounts with type Customer and by filtering out any other types of accounts.

To meet the requirement, Pamela performs the following steps:
  1. 1.

    She clicks Setup (gear icon) ➤ SetupObject ManagerOpportunityFields & RelationshipAccount Name and then clicks the Edit button.

     
  2. 2.

    Then, she navigates to the Lookup Filter section and clicks Show Filter Settings.

     
  3. 3.

    Pamela clicks the search icon and chooses Account Name. Then she chooses Type and clicks Insert.

     
  4. 4.

    For Operator, she chooses equals.

     
  5. 5.

    For Value/Field, she chooses Value.

     
  6. 6.

    Then, she clicks the search icon and chooses Customer.

     
  7. 7.

    Next, she clicks Insert Suggested Criteria.

     
  8. 8.
    At the end, she makes sure the filter type is set to Required and the Active check box is selected, as shown in Figure 5-10.
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig10_HTML.jpg
    Figure 5-10

    Configuration options available for the lookup filter

     
  9. 9.

    When done, Pamela clicks the Save button.

     

Going forward, whenever a sales rep creates a new opportunity, Salesforce only shows the account’s whose type is Customer.

Formula Fields: Small Work, Big Impact

Formula fields are Read Only fields that display values based on a formula’s expression that you define. When writing a formula’s expression, you can refer to fields from the parent object, and it can go ten levels deeper. This means, for example, when writing a formula on an Opportunity object , you can refer to the account owner’s e-mail, as shown in Figure 5-11.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig11_HTML.jpg
Figure 5-11

Account owner’s e-mail in the Advanced Formula tab

Let’s look at a few examples to get an idea of different business needs before charting a solution.
  • Pamela Kline wants to display a few fields from Account, such as Site, Industry, and Annual Revenue, on an Opportunity record so sales reps can see all data in one place.

  • Pamela wants to know if a customer’s birthday falls in the current calendar month.

  • Pamela wants to create a clickable phone number field that dials a phone number automatically, using a dialing tool, when clicked.

  • Carolina Lopez, a sales manager at GoC, wants to share monthly installation with support agents, but not the Loan Amount and Interest Rate fields, which reside in the Loan Details custom object.

The common objective in all the aforementioned scenarios is to perform some kind of automation. There are a few automation tools in Salesforce and each one has unique features. For now, we will use formula fields to solve the business scenarios just presented. In the next chapter, however, we study several automation tools in depth.

When you reference a field from the parent object in a formula’s expression, this type of formula is known as a cross-object formula , as shown in the screenshot in Figure 5-11. Using cross-object formulas, you can reference a field from the parent object (regardless of the whether the relationship is lookup or master detail).

You can create formula fields on standard or custom objects, but not on an external object. As of the Summer 2019 release, it is not possible to refer to fields on external objects in a formula. Any changes in the formula’s expression are reflected automatically in the formula’s field value.

Let’s rejoin Pamela Kline, a system administrator at GoC, who has been given the requirement to display the annual revenue of a customer on the Contact record.

To meet the requirement, Pamela performs the following steps:

  1. 1.

    She clicks Setup (gear icon) ➤ SetupObject ManagerContactFields & Relationship and clicks the New button.

     
  2. 2.

    Then she selects Formula as the data type and clicks the Next button.

     
  3. 3.

    She enters the field label Annual Revenue and chooses Currency as the data type, then clicks the Next button.

     
  4. 4.
    Pamela selects the Advanced Formula tab (1 in Figure 5-12) in the formula editor and then clicks Insert Field (2 in Figure 5-12). (The advanced formula editor contains many tools to create powerful formulas.)
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig12_HTML.jpg
    Figure 5-12

    Selecting the advanced formula editor

     
  1. 5.
    Next, Pamela navigates to Contact (1 in Figure 5-13) ➤ Account (2 in Figure 5-13) ➤ Annual Revenue (3 in Figure 5-13) and clicks the Insert button (4 in Figure 5-13) to select the Annual Revenue field from the Account object.
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig13_HTML.jpg
    Figure 5-13

    Field selection in the formula editor

     
  1. 6.
    When done, Pamela sees the formula’s expression (1 in Figure 5-14) in the text area. She can also use the functions (2 in Figure 5-14) provided by Salesforce to write a complex formula. (Functions are convoluted operations that are preimplemented by Salesforce.) After Pamela writes the formula, she clicks the Check Syntax button (3 in Figure 5-14) to confirm everything is in working order before saving. If there is a problem with her formula, the syntax checker will warn her.
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig14_HTML.jpg
    Figure 5-14

    Formula editor overview

     
  2. 7.

    Pamela the clicks the Next button, which redirects her to the page where she can establish field-level security. She does not make any changes, but leaves all the settings as default settings.

     
  3. 8.

    She clicks the Next button again, which allows her to add the formula field to her page layout.

     
  4. 9.

    Once done, she clicks the Save button.

     
Salesforce populates values in the Annual Revenue field (which is a formula field) for all contacts in the Salesforce database. Remember, formula fields are Read Only fields and no one is allowed to edit their value. Formula fields can be used in list views to filter data, as shown in Figure 5-15.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig15_HTML.jpg
Figure 5-15

All customers whose annual revenue is greater than US$100,000,000

Tip

Check out the help documentation published by Salesforce to learn more about formulas (https://help.salesforce.com/articleView?id=customize_functions.htm&type=5).

Rollup Summary Field

A rollup summary field is a custom field used to calculate values from related records and to display the value on a parent record. You can create rollup summary fields on parent records only if the objects have a master detail relationship.

For example, suppose there is a master detail relationship between the College and Student custom objects, where College is the parent object and Student is a child object. Using a rollup summary field, you can display the number of students currently active for each college record, as shown in Figure 5-16.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig16_HTML.jpg
Figure 5-16

Rollup summary field for the College record to determine the number of active students

A rollup summary field contains different functions, such as the following:
  • COUNT: This function is used to count the total number of related records.

  • SUM: This function is used to sum values in the related record’s field. You select the field from the Field to Aggregate drop-down. Only currency, number, and percent fields are available for selection.

  • MIN: This function is used to find the minimum value on a field. You select the field from the Field to Aggregate drop-down, across all related records. Only currency, date, date/time, number, and percent fields are available for selection.

  • MAX: This function is used to find the maximum value on a field. You select the field from the Field to Aggregate drop-down, across all related records. Only the currency, date, date/time, number, and percent fields are available for selection.

Let’s rejoin Pamela. She has been given a new requirement to display Sum of Open Opportunities Amount in the Account record. To meet this requirement, Pamela performs the following steps:

  1. 1.

    She clicks Setup (gear icon) ➤ SetupObject ManagerAccountFields & Relationship, then clicks the New button.

     
  2. 2.

    She then selects Roll-up Summary as the data type and clicks the Next button.

     
  3. 3.
    Pamela enters the field label Total amount (Open opportunities) and clicks the Next button, which opens a window where she enters the following details:
    1. a.

      Summarized Object: She selects the Opportunities object (1 in Figure 5-17).

       
    2. b.

      Select Roll-Up Type: She selects SUM as the rollup type (2 in Figure 5-17).

       
    3. c.

      Field to Aggregate: She selects Amount in the Field to Aggregate drop-down (3 in Figure 5-17).

       
    4. d.

      Filter Criteria: She selects Only records meeting certain criteria should be included in the calculation (3 in Figure 5-17) and then she selects Closedequals to False (4 in Figure 5-17) as filter criteria. At the end, her screen looks like Figure 5-17.

       
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig17_HTML.jpg
    Figure 5-17

    Rollup summary field to summarize the open opportunities amount

     
  4. 4.

    When done, Pamela clicks the Next button, which redirects her to the page where she can establish field-level security. She doesn’t make any changes, but leaves them as default values.

     
  5. 5.

    She clicks the Next button, which allows her to add the rollup summary field to her page layout.

     
  6. 6.

    Last, Pamela clicks the Save button.

     

Salesforce now populates Total amount (Open opportunities) field values for all opportunities. Remember, rollup summary fields are Read Only fields; no one is allowed to edit their value.

Tip

Check out the help documentation published by Salesforce to discover hidden gems regarding the rollup summary field (https://help.salesforce.com/articleView?id=fields_about_roll_up_summary_fields.htm&type=s).

Validation Rules

Validation rules help organizations improve quality of data by verifying that the data entered by users meet business standards. If the data don’t meet the standards, users get a prompt, with an error message, to fix the error, as shown in Figure 5-18.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig18_HTML.jpg
Figure 5-18

Validation rules error messages

A validation rule can contain a formula that evaluates the data in one or more fields and returns a value that is either True or False, where true means no error and false means there is an error. You can display the validation rule error message either at the top of the page (1 in Figure 5-18) or next to the field (2 in Figure 5-18).

Pamela Kline has been tasked with a requirement to validate that an account’s annual revenue is not negative and does not exceed US$1,000,000,000. To meet the requirement, Pamela performs the following steps:
  1. 1.
    She clicks Setup (gear icon) ➤ SetupObject ManagerAccountValidation Rules, then clicks the New button. This opens a window where she enters the following details:
    1. a.

      Rule Name: Pamela types Annual_revenue_cannt_be_greater_than_1bn.

       
    2. b.

      Description: She writes some meaningful text so other developers and administrators can understand easily why this custom field was created.

       
    3. c.
      Error Condition Formula: She uses the following formula:
      OR(
         AnnualRevenue < 0,
         AnnualRevenue > 1000000000
      )
       
    4. d.

      Error Message : She enters the following message: Annual revenue cannot exceed 1 billion.

       
    5. e.

      Error Location: She selects the Annual Revenue field.

       
     
  2. 2.
    At the end, her screen looks like Figure 5-19.
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig19_HTML.jpg
    Figure 5-19

    A validation rule to check annual revenue

     
  3. 3.

    Last, Pamela clicks the Save button.

     

Going forward, if users update their annual revenue with an amount greater than US$1,000,000,000, they get an error message and have to fix the error before they can save the record.

Tip

Check out the help documentation published by Salesforce to find examples of validation rules (https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5).

Custom Permissions: A Way to Bypass Validation Rules

Pamela is very happy. She just got an appreciation e-mail from her manager for all the work she has done, but it’s then followed by another request: is it possible to bypass the annual revenue validation rule for the following users, for now?
  • Carolina Lopez, Regional Sales Manager

  • Jerry Shannon, VP Sales

  • Donna Serdula, Senior Vice President

Pamela is also told that, in the future, the list of users may grow!

Fortunately, Pamela knows how to bypass validation rules for specific users or profiles. For example, she can bypass the annual revenue validation rule for system administrators by adding a condition to check their profile, as shown in Figure 5-20.
../images/472313_1_En_5_Chapter/472313_1_En_5_Fig20_HTML.jpg
Figure 5-20

Bypass a validation rule for a system administrator’s profile

Pamela wonders whether there is a better way to handle this requirement. She doesn’t want to modify the validation rule every time she is required to add a new user to the bypass validation list.

Custom permissions to rescue! Pamela learned recently that, by using custom permissions, she can grant users access to custom apps. In Salesforce, she can use custom permissions to check which users can access a certain functionality. Using custom permissions, she can bypass validation rules, formula fields, Process Builder, Apex triggers, and so on. Custom permissions let her define access checks that can be assigned to users via profiles or permission sets.

To meet the requirement, Pamela performs the following steps:
  1. 1.

    She clicks Setup (gear icon) ➤ SetupPLATFORM TOOLSCustom CodeCustom Permissions, and clicks the New button.

     
  2. 2.
    She creates a custom permission, as shown in Figure 5-21.
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig21_HTML.jpg
    Figure 5-21

    A custom permission

     
  3. 3.
    Now she creates a permission set (“Bypass validation rule”) and assigns the custom permission Bypass Validation Rule to it, as shown in Figure 5-22).
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig22_HTML.jpg
    Figure 5-22

    Assigning custom permission to a permission set

     
  4. 4.

    Next, Pamela modifies the annual revenue validation rule to add a custom permission check. To do so, she navigates to Setup (gear icon) ➤ SetupObject ManagerAccountValidation Rules and edits the annual revenue validation rule.

     
  5. 5.
    She modifies the formula as follows:
    AND(NOT($Permission.Bypass_validation_rule), OR(
           AnnualRevenue < 0,
           AnnualRevenue > 1000000000
           )
    )
     
  6. 6.
    To select the custom permission, she clicks Insert Field (1 in Figure 5-23) and then $PermissionBypass_validation_ruleInsert (2 in Figure 5-23).
    ../images/472313_1_En_5_Chapter/472313_1_En_5_Fig23_HTML.jpg
    Figure 5-23

    Selecting a custom permission

     
  7. 7.

    Last, she clicks the Save button.

     

Pamela assigns the Bypass Validation Rule permission to users Carolina Lopez, Jerry Shannon, and Donna Serdula. And that’s it! Now the validation rule is bypassed for these users. In the future, if Pamela wants to bypass a validation rule for other users, all she has to do is to assign the permission set to those users.

Points to Remember

  1. 1.
    The following picklist fields are not available for record types because they are controlled by sales processes, lead processes, support processes, and solution processes respectively:
    1. a.

      Opportunity Stage

       
    2. b.

      Case Status

       
    3. c.

      Solution Status

       
    4. d.

      Lead Status

       
     
  2. 2.
    The following campaign member picklist fields are not available for record types:
    1. a.

      Status

       
    2. b.

      Salutation

       
    3. c.

      Lead Source

       
     
  3. 3.

    It is not possible to deactivate a record type if it is in use by the Email-to-Case or On-Demand Email-to-Case routing e-mail address.

     
  4. 4.

    Lookup filters improve user efficiency by controlling the number of available records in a lookup search dialog.

     
  5. 5.

    In Lightning Experience, a lookup filter doesn’t work if a field referenced in the filtered lookup isn't added to the page layout.

     
  6. 6.

    It is not possible to refer to cross-object formulas in rollup summary fields.

     
  7. 7.

    Salesforce allows a maximum of ten unique relationships per object in cross-object formulas.

     
  8. 8.

    Formula fields can comprise up to 3900 characters, including spaces, return characters, and comments. If your formula needs more characters, create separate formula fields and reference them in another formula field.

     
  9. 9.

    It is not possible to reference long text areas, encrypted fields, or description fields in formulas.

     
  10. 10.

    It is not possible to delete fields referenced in formulas. Remove the field from the formula before deleting it.

     
  11. 11.

    When you delete a child record from a rollup summary field, Salesforce does not recalculate the value of the field. Select the Force a mass recalculation option on the edit page of the rollup summary field to recalculate the value manually.

     
  12. 12.

    When one validation rule fails, Salesforce continues to check other validation rules on that field, or other fields, on the page and displays all error messages at once.

     
  13. 13.

    It is possible to use rollup summary fields in validation rules. However, one cannot use a rollup summary field as a location to display an error message, because rollup summary fields do not display on edit pages.

     
  14. 14.

    You can create custom permissions only in the Enterprise edition or higher.

     

Hands-on Exercises

The following exercises will give you more practice with the platform, which ultimately will help you in gaining mastery of it, and also will assist you in preparing for the certification examination. Remember, these are hands-on exercises, and you can find the answers at the back of the book in the Appendix, but try to implement them in your Salesforce org, which is the primary goal of doing them.
  1. 1.
    Configure business processes on Lead in such a way that, when users create a lead for North America or Asia Pacific, they only see the following values on lead status:
    1. a.

      Lead status for North America

      New

      Suspect

      Interested

      Working

      Qualified (Converted)

       
    2. b.

      Lead status on Asia Pacific

      New

      Open

      Qualified (Converted)

       
     
  2. 2.
    Configure the Lead Lightning record page to include the following components:
    1. a.

      Activities

       
    2. b.

      Chatter

       
    3. c.

      Related List Quick Links

       

    Assign them to the North America record type only.

     
  3. 3.
    Dennis Williams, a system administrator at GoC, has to meet the following requirements for the Account Name field on the Contact object:
    1. a.

      The account name lookup dialog should only display accounts that have Mumbai as the site name.

       
    2. b.

      The previous constraint should not apply to users with a system administrator profile.

       

    How would you instruct Dennis to meet these requirements?

     
  4. 4.

    Business managers at GoC found that sales reps are creating opportunities for competitors’ accounts. As an app builder, how can you restrict sales reps from selecting competitors’ accounts while creating a new opportunity?

     
  5. 5.

    Create a custom field (data type: Lookup Relationship) on the Opportunity object with the Contact object. This should allow users to select a contact when creating a new opportunity.

     
  6. 6.

    Keeping the previous requirement in mind, configure the lookup in such a way that it only displays the contacts related to the account with which the opportunity is associated!

     
  7. 7.
    Dennis wants to implement opportunity management at GoC, but he is a bit confused by one of the requirements. Because you now have a better understanding of record sharing, please help him select the appropriate sharing architecture to fulfill the following requirements:
    1. a.

      When the opportunity amount is greater than US$1,000,000 make sure the Next Step field is required.

       
    2. b.
      However, make sure it doesn’t apply to the following users:
      • Jerry Shannon, VP Sales

      • Users with a system administrator profile

      • Users with the sales rep-APAC profile

       
     
  8. 8.
    Help Dennis to write the correct formula for the following requirements (formula field):
    1. a.

      Create a custom field that determines the telephone country code of a contact based on the shipping country on the shipping address.

       
    2. b.

      Create a custom drop-down on a contact’s preferred phone with the values Home Phone, Asst. Phone, Other Phone, and Phone. Now create a formula field that shows the phone number based on what the user provided in the Preferred Phone field.

       
    3. c.

      Create a formula field that displays the first three characters of a name and year from the Date of Birth field separated by a dash.

       
    4. d.
      Create a formula field on Account that displays the ratings Hot, Warm, or Cold based on the following criteria:
      • Annual revenue should be greater than US$50,000,000.

      • The billing country should contain United States, US, USA, CANADA, CA, MEXICO, MX .

      Now, if the account fulfills these two requirements and they belong to
      • type Reseller, Integrator, or Partner, then the rating should be Hot

      • type Prospect or Investor, then the rating should be Warm

      • everything else, then the rating should be Cold

       
    5. e.

      Create a formula field on the Opportunity object to calculate the number of days since an opportunity with an account was opened. If the opportunity is closed (either won or lost), this field should be blank.

       
    6. f.

      Create a formula field on the Contact object that displays the month as a text string instead of a number from the Date of Birth field.

       
    7. g.

      Create a formula field on Lead to calculate the number of days the lead has been open. If the lead is qualified or unqualified, then the formula field should be blank.

       
     
  9. 9.
    Help Dennis to write the correct formula for the following requirements (validation rule):
    1. a.

      Create a validation rule to prompt an error message to users if a quote line-item discount exceeds 23%.

       
    2. b.

      If the Phone field on the Contact object doesn’t contain ten digits, display an error message to the users.

       
    3. c.

      Create the custom field Delivery Date on the Opportunity object. Now write a validation rule to make sure that this custom field must be populated if an opportunity stage is Closed Won or Negotiation/Review.

       
    4. d.

      Write a validation rule to make sure the close date of an opportunity cannot be in the past.

       
    5. e.

      Write a validation rule to make sure that users are only allowed to update the opportunity if they have added products to the opportunity.

       
    6. f.

      Write a validation rule that prevents sales reps from changing Opportunity Stage to anything other than Closed Won or Closed Lost, after Opportunity Stage is set to Closed Won or Closed Lost.

       
    7. g.

      Write a validation rule to make sure the probability of a lost opportunity is set to 0%.

       
     
  10. 10.

    Create a custom field on Account to display the maximum amount from the related opportunity that is marked Closed Won.

     

Summary

In this chapter, we covered record types and how they include pages in Salesforce Classic vs. Lightning Experience. We also studied different mechanisms to improve data quality using filter lookups and validation rules. Furthermore, we reviewed rollup summary and formula fields by examining a few examples. In the next chapter, we dive into how to automate business processes using out-of-the-box automation tools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.68.197