Learning Objectives

After completing this tutorial, you will be able to:

  • Build Custom Objects in Salesforce
  • Add Shared Linked Sections to a Form Template that leverages fields on Custom Objects
  • Collect and Store Repeating Information

Prerequisites: Build Your First Form TemplateField LinksBranching LogicAllow New Records & Linked Sections

Shared Linked Sections

As outlined in the previous tutorial, Linked Sections can be used to store repeating information and data when it may be unclear how much data needs to be created from a form. We created a linked section that looks up to a standard Salesforce object (Contact), but this can also be done for custom objects. Arabica Coffee has their own custom object where they house data about their coffee products and track inventory. For this tutorial, we will create a Shared Linked Section to hold inventory data about specific Arabica products on the store shelves including their product locations and the amount in stock.

The store rep needs to capture data about the Quantity, Cost, and Shelf Location of each coffee product they encounter in the store. The rep doesn’t know how few or how many products they will encounter and so a Linked Section will help us capture this data and store the known information as records on a related list. Arabica Coffee can then track and report on this in the future. For example, if Arabica Coffee finds that after each visit, Monroe Markets consistently has a low inventory of the same coffee beans, Arabica can assume these beans are selling quickly and can take swift action to ensure this product is always well stocked.

A Shared Linked Section differs slightly from a regular Linked Section in that it allows for pre-populating linked sections on a form using the information in a related list. So in this case, the Arabica Coffee rep would be able to see the coffee inventory for Monroe Markets right when they start a new form and also have the ability to edit that information or create new Linked Sections for new products to capture more data about inventory during their visit.

We’ll start this tutorial by creating the necessary Custom Objects for Arabica Coffee. Begin by logging into your Salesforce Org where you’ve been completing your tutorials.

Create Custom Objects and an Inventory List

  1. We’ll assume that Arabica Coffee Co. already has a Custom Object called Coffee Products in their Salesforce instance. This is where they keep an updated inventory list of all the coffee products they offer in stores.
    Youreka Listing coffee product list.jpg
  2. We will learn how to replicate this list later in the tutorial, but we must first create a custom object for the Linked Section that looks up to the form object and contains custom fields to serve as the fields for Quantity, Cost, and Shelf Location.
    • In classic: Setup > Create> Objects > New Custom Object
    • In LEX: Setup > Object Manager > Create > Custom Object
  3. Enter the name Coffee Products in the label field. Do the same for Plural Label. The Object name will auto-populate. This is where we will keep the inventory lists of all the names of the Coffee Products we offer. When finished click Save & New.
    youreka form new custom object3.jpg
  4. Click and create another New Custom Object and enter the name Coffee Count in the label field. Do the same for Plural Label. Object name will auto-populate. When finished click Save.
    new custom object coffee4.jpg
  5. Under Custom Fields & Relationships (Fields & Relationships in LEX) on the Coffee Count detail page, select New.custom fields and relationships youreka.jpg
  6. Our first custom field will be a lookup relationship to the Form Object which is necessary for all Linked Sections. Select Data Type = Lookup RelationshipRelated to = FormField Name = FormNext > Next > Next > Save & New.
  7. Our second custom field will be a lookup relationship to our Coffee Products which will pull from our existing coffee inventory list to be available on the form. Select Data Type = Lookup RelationshipRelated to = Coffee ProductsField Name = Coffee_ProductsNext > Next > Save & New.LS_9.jpgLS_10.jpgLS_11.jpg
  8. Our third custom field will be a Number field to capture the Quantity of the coffee product on the shelves. Select Data Type = Number, Field Label = Quantity, Next > Next > Save & New.
  9. Our fourth custom field will be a Currency field to capture the Cost of the coffee product at this store. Select Data Type = CurrencyField Label = CostLength = 16Decimal Places = 2, Next > Next > Save & New.
  10. Our fifth field will be the Shelf Location which we will offer as a Picklist field on our form with the options of Top Shelves, Middle Shelves, or Bottom Shelves. Select Data Type = PicklistField Label = Shelf LocationValues = Enter Values, with each value separated by a new lineNext > Next > Save.
  11. Create one final field which will be a Lookup Relationship from the Coffee Count Object to the Account Object. This will ensure that inventory data is accessible to users who may be viewing and reporting on the inventory data that is collected. The best way to do so is by having our custom Coffee Count object exist as a Related List on the Account Page Layout.
    Shared Linked Sections 3.jpg
  12. Now we need to start populating the inventory Coffee Products inventory list in Salesforce as shown at the beginning of this tutorial. To do this we need to enter setup then navigate to Create > Tabs (User Interface > Tabs in LEX) and click New to create a new custom object tab.LS_15.jpg
  13. From the object dropdown select Coffee Products. Then select the Tab Style by clicking the hourglass and selecting Cup. Click Next and Save.LS_16.jpg
  14. Now we want to populate our inventory of Coffee Products to replicate the list that was introduced at the beginning of this tutorial. Navigate to the newly created tab which allows us to create new records for each Coffee Products that Arabica Coffee Co. offers.
  15. On the tab navigation select the dropdown arrow in the top right of the navigation bar and select Coffee Products (App Launcher > Coffee Products in LEX).
  16. Select New and add in the following Coffee Products to our inventory (be sure to select Save & New after each entry to avoid having to reenter the object):
    • Kona Medium Roast
    • Sumatran Dark Roast
    • Kenyan Fruit Blend
    • Colombian Arabica Decaf
    • Colombian Arabica
    • Arabica Espresso Bean
    • Arabica Hazelnut Espresso Blend
    • Kenyan Bean
    • Kenyan Bean Decaf
    • Arabica Breakfast Blend
    • Rwandan Dark Roast
      Youreka forms products cofee list.jpg

Add a Linked Section to your Form Template

  1. Click the Form Templates tab from the navigation bar and select the Arabica Coffee Store Visit template.
  2. From the Form Template Detail Page, either delete the associated forms you have in the forms list or select the settings button to Copy for a New Version.
  3. Click Edit to make changes to your template.

  4. Drag and Drop a Linked Section into the template builder in between the Store Contact Information and the General Information sections.
  5. This will open the Linked Section Edit Box. Name your section Inventory Count with 1 column, Linked to the Coffee_Count__c object, with the Object Lookup set to Form__C.

  6. To make this a Shared Linked Section, switch to the Shared Linked Sections tab and check the checkbox to Share with existing related records.
  7. You will be prompted to indicate which Form Lookup you wish to share this Linked Section with. In this case, since the Coffee Inventory is related to each account, we will leverage the lookup relationship we created in the Linked Section tutorial between Account and Coffee Count. Set the Form Lookup for Sharing field to disco__Form_Account__c and the Linked Section Lookup for Sharing field to Account__c. You should also choose which order you want these records to show up in. Ordering them by the Coffee Products name makes sense here.

    *optional* Remember, we’re using Shared Linked Sections to pre-populate coffee products in a form for any given account that we’re responsible for visiting. However, there might be a reason why we would want to only show certain coffee products for our users. Perhaps we only want to show decaf coffee products, or coffee products within a certain cost window. We can control which related records will pre-populate for our forms users by leveraging the Linked Section Sharing Filters. Indicate that you’d like to display Coffee Products from A-Z, that you only want a maximum of 20 products to populate the form, and that you’d only like to display coffee that is less than $12.00.SLS Filters.jpg
  8. Click Save to continue.
  9. Drag and Drop a new Question into the Linked Section. Name the Question Product Name with the Field Link Field set to: Coffee Products.
  1. Repeat step 25 for the following field link questions as well, noting the Question Text and Field Link Field. All other options should remain default.
    Question Text Field Link Field
    Quantity Quantity
    Cost Cost
    Shelf Location Shelf Location
  2. From the template builder screen, your Linked Section should be complete and look like this:
  3. Preview your template and in the Inventory Count Section, start to type “Kenyan” and see the options available that are looking up to our inventory list.LS_24.jpg
  4. Save and close out of your Form Template to return to the Form Template Detail Page.
  5. From the settings button, Publish your template.

Create a New Form

  1. Create a New Form from using mock data from your instance. We will demonstrate with the Monroe Markets Account record and Peter Parker’s contact record.New Form Wizard.jpg
  2. For the purpose of this form, we will focus on adding a couple of linked sections to test its functionality. The Store Contact Information should prepopulate and enter mock data for the General Information Section.
  3. Under the Inventory Count Section, click the Add + button.
  4. Add a Linked Section with the following information:
    • Name: Kenyan Bean Decaf
    • Quantity: 14
    • Cost: 11.99
    • Shelf Location: Middle Shelves
  5. Add another Linked Section with the following information:
    • Name: Colombian Arabica
    • Quantity: 10
    • Cost: 9.99
    • Shelf Location: Middle Shelves
  6. The Arabica Coffee rep could potentially add in as many of these linked sections as necessary to capture all of the products in that particular store.
  7. Once complete, save the form.

Make Linked Section Data Available on the Account Layout

  1. From the Form Detail Page, click the Navigate To menu on the left-hand side and navigate to the associated Account record (Monroe Markets).
  2. Notice that the related list containing your Linked Section data doesn’t automatically appear as a part of the page layout, but you can add it in just a few simple steps. From the right-hand side of the screen, open the arrow that leads to the Quick Access Menu. Select Edit Layout. (in LEX Setup > Object Manager > Account > Page Layouts > Account Layout)
    Monroe Markets Edit Layout.jpg
  3. From the Edit Page Layout screen, you can now drag and drop the Coffee Count related list into the account layout. We then need to customize the list to include the fields that are meaningful from our inventory object. Select the Wrench Icon next to Coffee Count.
  4. This opens the Related List Properties modal for the Coffee Count Object. From the list of available fields, we want to add in the fields that were meaningful in our linked section, including Coffee Products, Quantity, Cost and Shelf Location. Click and Add each field from the Available Fields list to the Selected Fields List. Click Ok when finished.New_6_Wrench Icon.jpg
  5. The Related List will now contain the selected fields.New_7_Coffee Count Layout.jpg
  6. Save the Account Layout to return to the Monroe Markets Account record.
  7. You should now see your Coffee Count related list with all of the associated Coffee Products and details. If this exercise was performed correctly, you will see the two Coffee Products appear in this list which we created in the form. Any future Coffee Products captured from this linked section will also appear in this list.Any future Coffee Products captured from this linked section will also appear in this list.
    New_8_Coffee Count Related List.jpg

You have now created multiple Custom Objects, an Inventory List, and added a Shared Linked Section to your Form Template to be used to collect repetitive data about Arabica Coffee products in stores.