Map a Custom Object

Capturing Data in Custom Objects

It’s time to tackle the other challenge at No More Homelessness (NMH): tracking information gathered from donor surveys, if the survey has been completed, and if it's been acknowledged. NMH’s solution is to create a custom object and import what they've tracked in spreadsheets.

In this step we’ll follow along as Gorav, NMH’s fearless admin, creates a custom object and associated fields, modifies the NPSP Data Import staging object, and maps the fields for the importer. If some of the steps here sound familiar, that’s because we’re following the same steps we did previously with fields on a standard object, but for fields on a custom object instead. 

A process diagram with create target fields, create staging fields, and connect staging and target fields highlighted

Note

Note

The custom object we’ll create here is an example and not a full solution. NMH would have to add additional fields and functionality to meet its needs. Remember to check the Salesforce AppExchange (linked in Resources) to see if there’s a solution ready-made for your real-world challenges.

Create the Custom Object and Fields

First, let’s create the custom object:

  1. Go to Setup.
  2. Click Object Manager.
  3. Click Create, then Custom Object.
  4. Enter this information:
    1. Label: Donor Survey
    2. Plural Label: Donor Surveys
    3. Object Name: Donor_Survey (This should populate automatically.)
    4. Description: For tracking donor surveys and acknowledgements.

      The Custom Object Information area of the new Custom Object page

    5. In Enter Record Name Label and Format:
      1. Enter Survey Number for the Record Name.
      2. Select the Data Type of Auto Number.
      3. In Display Format, enter DS-{0000}.
      4. In Starting Number, enter 0001.
    6. Select Allow Reports.
    7. Select Allow Activities.
    8. In the Object Creation Options section, check Launch New Custom Tab Wizard after saving this custom object.
  5. Click Save.
  6. Click on Tab Style and select an icon. We chose Form, but you can get creative.
  7. Click Next, then Next, then Save.
Note

Note

If you want more details on creating custom objects, check out Custom Objects: Quick Look, linked in Resources.

The donor survey object is now created. Next, let’s add the fields.

We’ll add two fields to this object, but one is a picklist for which we want to create a new picklist value set. Let’s start there.

  1. Click Home in Setup.
  2. Enter Picklist in the Quick Find box, then select Picklist Value Sets.
  3. Next to Global Value Sets, click New.
  4. In Label, enter Survey Status.
  5. In Name, enter Survey_Status. (This should populate automatically.)
  6. Enter these values, one per line:

    Sent
    Completed
    Thanked


  7. Click Save.

Now, we’re ready to add the fields.

  1. Click Object Manager in Setup.
  2. Find and select the Donor Survey object.
  3. Click Fields & Relationships.
  4. Click New.
  5. Select Lookup Relationship, and click Next.
  6. Select Contact in the Related To field, and click Next.
  7. Leave the Field Label as Contact and Field Name as Contact, and click Next.
  8. Click Next, then Next, then Save & New to create the next field.
  9. Select Picklist, and click Next.
  10. Enter these details:
    1. Field Label: Status 
    2. Leave Use global picklist value set selected, and then select Survey Status from the picklist.
    3. Field Name: Status (This should populate automatically.)
  11. Click Next, then Next, then Save.

NMH would need other fields to make this object useful, but we’ll stop here to focus on mapping.

Let’s check out the new object by clicking App Launcher ( The App Launcher icon), then finding and selecting Donor Surveys. None exist yet, so click New to check that all of your new fields are there as you’d expect.

A new donor survey

Create Staging Fields

Now we need to modify the NPSP Data Import object to add one of the new fields we just created. Why only one? Because our new donor survey object uses lookup fields to connect to contact records and those are already in the NPSP Data Import object. We will map them later.

Let’s create the staging field we need now for the status.

  1. Go to Setup, then click Object Manager.
  2. Find and select the NPSP Data Import object.
  3. Click Fields & Relationships.
  4. Click New.
  5. Select Picklist, and click Next.
  6. Enter these details:
    1. Field Label: Donor Survey Status 
    2. Leave Use global picklist value set selected, and then select Survey Status from the picklist.
    3. Field Name: Donor_Survey_Status (This should populate automatically.)
  7. Click Next, then Next, then Save.

We also want to create two new system fields to capture information about the target records processed by NPSP Data Importer: a status field that indicates if the dry run or import was successful and a lookup field that links you to the final imported record.

  1. Starting from the Fields & Relationships tab on NPSP Data Import record in the Object Manager, click New.
  2. Select Text, and click Next.
  3. Enter these values:
    1. Field Label: Donor Survey Import Status
    2. Length: 255 (You must enter this max allowable value of 255 for a text field for all Import Status fields.)
    3. Field Name: Donor_Survey_Import_Status (This should populate automatically.)
  4. Click Next, then Next, then Save & New to create the next field.
  5. Select Lookup Relationship, and click Next.
  6. In the Related To field, select Donor Survey and click Next.
  7. Change the Field Label to Donor Survey Imported and press the tab key to populate the Field Name with Donor_Survey_Imported, then click Next.
  8. Click Next, then Next, then Save.

Clean Up the Page Layout

While we’re on the NPSP Data Import object in the Object Manager, let’s clean up the page layout so it’s easy to find our new fields. Taking the time to order your NPSP Data Import page layout can help you quickly review imported data and save you time later on.

  1. Click Page Layouts.
  2. Click Data Import Layout.
  3. Let’s add a new section first. With Fields highlighted at the top of the screen, click and drag the Section element onto the page after the Donation Information section.

    The Section element under the Fields menu

  4. Name your section Donor Survey Information and click OK.
  5. Our new fields appear by default in the Information section at the top of the page. You can click and drag these to your new section from here, or click the remove button (The remove button) and then drag them from the top Fields area to the new section.

    The Donor Survey Information section in the layout editor

  6. Click Save.

If you go to one of the NPSP Data Import records we were working with before, the new section should look something like this.

The Donor Survey Information section on the NPSP Data Import record

Create Advanced Mappings

With all of our fields in place and the page layout cleaned up, it’s time to connect the donor survey object and the NPSP Data Import object with Advanced Mapping. 

Remember when we mapped our new and standard fields for Contact1 and Contact2? We modified an existing object group. Because we are mapping a new object, we need to create a new object group.

Let’s start there.

  1. Click on the App Launcher (The App Launcher icon), then find and select NPSP Settings.
  2. Click System Tools.
  3. Click Advanced Mapping for Data Import & Gift Entry.
  4. Click Configure Advanced Mapping.
  5. Click Create New Object Group.

    The Create New Object Group button

  6. Enter these details:
    1. Group Name: Donor Survey
    2. Object Name: Donor Survey (Donor_Survey__c)
    3. Is Child/Parent: Child
    4. Of This Object Group: Contact 1
    5. Through This Field: Contact (Contact__c)
    6. Link to Record: Donor Survey Imported (Donor_Survey_Imported__c)
    7. Import Status: Donor Survey Import Status (Donor_Survey_Import_Status__c)

      The Create Object Group interface

  7. Click Save.

It may take a few seconds to process the new object group. Once that process is complete, it’s time to add the field mappings.

  1. In the Donor Survey row, click the menu arrow (The menu arrow) and select View Field Mappings.
  2. Click Create New Field Mapping.
  3. Find and select Donor Survey Status (Donor_Survey_Status__c) as the source.
  4. Find and select Status (Status__c) as the target.

    The New Donor Survey Field Mapping interface for the Donor Survey Status field

  5. Click Save.

That should do it.

We’ve created the new custom target object and fields, created staging fields on the NPSP Data Import object, and created our mapping. Now, let’s get our data ready and bring it into Salesforce.

We’ll tackle that in the next step, but before we move on, make sure that you select the Trailhead Playground where you followed along with this step and click Verify.

Resources