Make Declarative Changes in Your Scratch Org
In this exercise, you will…
- Use Object Manager to open the “Travel Expense” custom object
- Add a field named “Approved” to the “Travel Expense” custom object
- Try to view the “Travel Expense” custom object (spoiler alert: you can’t)
- Create a Custom Object Tab for “Travel Expense”
- Create a “Travel Expenses” Lightning App
Use Object Manager to open the “Travel Expense” custom object
- In your scratch org, inside of Setup, click on the Object Manager tab.
- Search for “travel” in the Quick Find box, then click on the Travel Expense object link.
Add a custom field named “Approved” to the “Travel Expense” custom object
Step 1 of 5: Use the Object Manager to create a new field
- Make sure you’re in the Object Manager page for Travel Expense.
- Click on the Fields & Relationships menu item.
- Click on the New button.
Step 2 of 5: Choose the field type
- Select the Checkbox Data Type.
- Click Next to continue.
Step 3 of 5: Enter the details for this field
- Set the Field Label to
Approved
. - Set the Default Value to
Unchecked
. - Make sure the Full Name is set to
Approved
. - Click Next to continue.
Step 4 of 5: Establish field level security
- Check, then un-check Visible to make sure that it’s left unchecked on all profiles.
- Check, then un-check Read-Only to make sure that it’s left unchecked on all profiles.
- Click the Next button to continue.
Step 5 of 5: Add to page layouts
- Make sure that this field is added to the Travel Expense Layout
- Click Save to finish creating this field.
After saving your custom field, your screen should look something like this:
- Note that the previous field and your new field both have a namespace prefix, even though you’re not developing in a packaging org. This is the power of Namespaced scratch orgs!
Try to view the “Travel Expense” custom object (spoiler alert: you can’t)
- Open the App Launcher.
- Search for an app item or object named
Travel Expense
- You don’t see anything because there isn’t a custom tab for this object yet. We’ll fix that next.
Create a Custom Object Tab for “Travel Expense”
In order for users to interact with the Travel Expense object you’ll need to create an object tab for it.
Step 1 of 4: Create a new Custom Object Tab
- In Setup, click the Home tab.
- Type “tabs” into the Quick Find box.
- Click on the Tabs menu item.
- Click the New button in the Custom Object Tabs section.
Step 2 of 4: Define the details of your Custom Object Tab
- Select the Travel Expense custom object.
- Select the “Credit Card” tab style.
- Keep Splash Page Custom Link set to “None” and add a Description.
- Click Next to continue.
Step 3 of 4: Specifiy the app visibility for this tab (“Tab Hidden” for all)
- Make sure that tab visibility is set to “Tab Hidden” for all profiles.
- Click Next to continue.
Step 4 of 4: Add the tab to Custom Apps
- Uncheck all boxes here (you’ll be assigning the app via a permission set in an upcoming exercise)
- Click Save to finish creating the Custom Tab.
After saving your custom object tab, your screen should look something like this:
Create a “Travel Expenses” Lightning App
Step 1 of 6: Create a New Lightning App
- In Setup, click the Home tab.
- Type “app man” in the Quick Find box.
- Click on the “App Manager” menu item.
- Click the New Lightning App button.
Step 2 of 6: Specify App Details and Branding
- Set the App Name to
Travel Expenses
. - Set the Developer Name to
Travel_Expenses
. - Click the Next button.
Step 3 of 6: Set the Navigation and Personalization options
- Use the Standard Navigation setting.
- Use Setup (full set of Setup options).
- Click Next to continue.
Step 4 of 6: Specify options for Utility Items
- Don’t set anything here. Just click Next to continue.
Step 5 of 6: Specify the Navigation Items
- On the list of Available Items, enter “travel” in the search box.
- Highlight the Travel Expenses item and move it from left to right by clicking the right-facing arrow. It should END up in the position highlighed by the screen shot.
- Click the Next button to continue.
Step 6 of 6: Specify User Profiles that can access this app
- Make sure that no profiles are selected.
- Click Save & Finish to continue.