Table of Contents
Introduction
We’re on a critical mission. The CEO of Obliteration Ltd., Dark Lord, banished the last Salesforce Admin for the grave error they made in an org that destroyed a battle station by our mortal enemies with a single shot to an exposed dark engine port.
We’ve been assigned to manage the construction of a new battle station. There is no time and space for error. Else, we may not see tomorrow.
Let’s create an App to solve this issue using these five steps:
- Create the App with a custom object.
- Add custom fields to the object.
- Modify the UI for a seamless experience.
- Automate using validation rules and flow.
- Create reports and dashboards to track the total cost of the battle station.
Let’s get started!
Create the Battle Station App
1. Create the Custom Object, Battle Station
Let’s start by creating a Custom Object, Battle Station.
a. From Setup, open Object Manager.
b. Click Create and then select Custom Object.
c. Enter the following:
- Label: Battle Station
- Plural Label: Battle Stations
- Under Optional Features, check to Allow Reports.
- Under Search Options, check Allow Search.
- Check the box for Launch New Custom Tab Wizard after saving this custom object.
d. Click Save.
You should be on the Custom Object Tab page for Battle Station.
e. Enter the following:
- Object: Battle Station
- Tab Style: Choose an icon of your liking
f. Leave the rest as is. Click Next, Next, and Save.
2. Enable Feed Tracking for the Battle Station Object
Enabling feed tracking helps us detect changes to tracked record fields and post them as updates in the What I follow feed.
a. From Setup, enter Feed in the Quick Find Box and open Feed Tracking.
b. Select Battle Station for Object.
c. Check the box for Enable Feed Tracking.
d. Select the fields, Owner and Battle Station Name.
e. Click Save.
3. Create an App
Let’s create a basic App using the App Manager. We’ll build on this App moving forward.
a. From Setup, type App Manager in the Quick Find Box, and open App Manager.
b. Click New Lightning App.
c. In App Details & Branding, enter Battle Station Construction for App Name.
d. Leave the rest as is, and then click Next, Next and Next.
e. In Navigations Items, move the following from Available Items to Selected Items.
- Battle Stations
- Reports
- Dashboards
f. Click Next.
g. For User Profiles, move System Administrator from Available Profiles to Selected Profiles.
h. Click Save and Finish.
That’s it! We’ve established the foundation for our App. Let’s visit the App to verify the changes.
4. Visit the App
From the App Launcher () , launch Battle Station Construction. You should be directed to a page just like the one below!
You should be able to view the following:
- App Launcher: Your doorway to all available Apps.
- App Name: Displays the name of the current App.
- Navigation Menu: Displays all the tabs available on the App.
Build the Object Model
Now that we’ve created a foundation for our App, let’s create the objects and associated fields required by our App.
1. Battle Station Custom Object
A. Status Field
This custom picklist field will be used to display the Status of the Project.
a. From Setup, open Object Manager and select Battle Station.
b. Open Fields & Relationships from the sidebar.
c. Click New.
d. For Field Type, select Picklist. Click Next.
e. Enter the following:
- Field Label: Status
- Choose Enter values, with each value separated by a new line.
- Values: Green, Orange, Red, Complete
- Select Use first value as default value
- Uncheck Restrict picklist to the values defined in the box
f. Click Next, Next, and Save & New.
B. Add a Category Field
This field will make it easy to keep track of Weapons and their current status.
a. For Field Type, select Picklist. Click Next.
b. Enter the following:
- Field Label: Weapon Status
- Select Enter values (with each value separated by a new line)
- Values: Not Yet Functional, Fully Functional
- Select Use first value as default value
- Uncheck Restrict picklist to the values defined in box
c. Click Next, Next, and Save.
2. Resource Custom Object
Let’s create an Object to keep track of the resources, a.k.a, employee type, that we need to do the actual work of building the Battle Station.
a. From Setup, open Object Manager.
b. Click Create and then select Custom Object.
c. Enter the following:
- Label: Resource
- Plural Label: Resources
- Under Optional Features, check Allow Reports.
- Check the box for Launch New Custom Tab Wizard after saving this custom object.
d. Click Save.
You should be on the Custom Object Tab page for Resource.
f. Enter the following:
- Object: Resource
- Tab Style: Choose an icon of your liking
g. Leave the rest as is. Click Next, Next, and Save.
A. Add a Quantity Field
This field will keep track of the number of resources of each type we need to keep the project running.
- From Setup, open Object Manager and select Resource.
- Open Fields & Relationships from the sidebar.
- Click New.
- For Field Type, select Number. Click Next.
- Enter the following:
- Field Label: Quantity
- Select Required ( Always requires a value in this field in order to save a record)
- Click Next, Next, and Save & New.
B. Add a Utilization Field
This field helps us to keep track of the resource’s utilization in the current project. For example, a resource may work 60% on one project and 40% on another.
- For Field Type, select Percent. Click Next.
- Enter the following:
- Field Label: Utilization
- Select Required ( Always requires a value in this field in order to save a record)
- Click Next, Next, and Save & New.
C. Add a Battle Station (Master-Detail Relationship) Field
This field will let us know the specific Battle Stations a resource is allotted to.
- For Field Type, select Master-Detail Relationship. Click Next.
- Enter the following:
- Related to: Battle Station
- Click Next, Next, Next and Save.
3. Supply Custom Object
Let’s create an Object to keep track of the supplies and equipment required to build the battle station.
- From Setup, open Object Manager.
- Click Create, and then select Custom Object.
- Enter the following:
- Label: Supply
- Plural Label: Supplies
- Under Optional Features, check Allow Reports.
- Check the box for Launch New Custom Tab Wizard after saving this custom object.
- Click Save.
You should be on the Custom Object Tab page for Supply.
- Enter the following:
- Object: Supply
- Tab Style: Choose an icon of your liking
- Leave the rest as is. Click Next, Next, and Save.
A. Add a Quantity Field
This field will keep track of the number of supplies of each type we need to keep the project running.
- From Setup, open Object Manager and select Supply.
- Open Fields & Relationships from the sidebar.
- Click New.
- For Field Type, select Number. Click Next.
- Enter the following:
- Field Label: Quantity
- Select Required ( Always requires a value in this field in order to save a record)
- Default Value: 2
- Click Next, Next, and Save & New.
B. Add a Unit Cost Field
This field helps us to keep track of the cost per unit of the Supply record.
- For Field Type, select Currency. Click Next.
- Enter the following:
- Field Label: Unit Cost
- Length: 16
- Decimal Places: 2
- Select Required ( Always requires a value in this field in order to save a record)
- Click Next, Next, and Save & New.
C. Add a Total Cost Field
This field helps us to keep track of the total cost of the Supply record.
- For Field Type, select Formula. Click Next.
- Enter the following:
- Field Label: Total Cost
- Formula Return Type: Number
- Decimal Places: 2
- Click Next.
- Enter the following Formula.
Quantity__c * Unit_Cost__c
- Click Check Syntax.
- Click Next, Next, and Save & New.
D. Add a Battle Station (Master-Detail Relationship) Field
This field will let us know the supplies required by a specific Battle Station.
- For Field Type, select Master-Detail Relationship. Click Next.
- Related to: Battle Station
- Click Next, Next, Next and Save.
4. Visit the App and Test out the Changes
From the App Launcher () , launch Battle Station Construction. How does it look so far? We don’t want to upset the Dark Lord.
Modify the User Experience
We created the App, related objects, and fields, but that’s not enough. Now, let’s ensure the employees have a great experience on the App. Let’s tinker with the Page Layout to modify the UI of the App.
1. Modify the Page Layout
Let’s move around fields in the page layout for Battle Station to make it more appealing to the eyes.
- From Setup, open Object Manager, and select the object Battle Station.
- From the sidebar, select Page Layouts.
- Open Battle Station Layout.
- Drag the fields, Weapon Status, and Status to the right column.
Let’s edit the related list layout too!
- Click the wrench icon right next to the Resources label.
- Move the fields Quantity and Utilization from Available Fields to Selected Fields. Click OK.
- Click the wrench icon next to the Supplies label.
- Move the fields Quantity, Unit Cost, and Total Cost (in the same order) from Available Fields to Selected Fields. Click OK.
- Click Save.
We should be left with a layout similar to this:
2. Add some Sample Data
Let’s input some data after creating a record of the Object, Battle Station.
- From the App Launcher (
) , launch Battle Station Construction.
- Open the Battle Stations tab, and click New.
- Enter Mission Critical for Battle Station Name. Click Save.
- Open the Related tab.
- Click New in the Resources-related list.
- And enter the following Resource Name one at a time (click Save & New after inputting each record). Enter a value of your choice for Quantity and Utilization.
- Dark Engine Port Manager
- Barista
- Trainer
- Soldier
- Construction Worker
- Sous Chef
- Chiropractor
- Click New in the Supplies-related list.
- And enter the following Supply Name one at a time (click Save & New after inputting each record). Enter a value of your choice for Quantity and Unit Cost.
- Coffee Powder
- Dark Engine
- Wrench
- Laser Vision Glasses
- Dark Matter Bricks
- Secret Metal
- Dark Engine Port
The Related tab for Mission Control should be similar to this:
3. Add a Rollup Summary
Let’s create a Rollup Summary field that will show the total number of resources on the Battle Station.
- From Setup, open Object Manager and select Battle Station.
- Open Fields & Relationships from the sidebar.
- Click New.
- For Field Type, select Roll-Up Summary. Click Next.
- For Field Label, enter Total Resources.
- Click Next.
- For Summary Calculation, enter:
- Summarized Object: Resources
- Select Roll-Up Type: Sum
- Field to Aggregate: Quantity
- Click Next, Next, and Save.
4. Test the App
From the App Launcher () , launch Battle Station Construction. How does it look so far? We can’t afford to make any dark mistakes.
Add Business Logic
Let’s ensure that our data stays clean and up-to-date with some business logic!
1. Create a Validation Rule
Let’s create a validation rule that ensures the Dark Engine Port Managers are working overtime to ensure all ports are secure. We don’t need to be making the same mistakes again.
- From Setup, open Object Manager and select Resource.
- Open Validation Rules.
- Click New.
- Enter the following:
- Rule Name: Port Managers Overtime
- Error Message: Port Managers must work at least 150% to avoid obliteration.
- Error Location: Utilization
- Error Condition Formula:
Name = "Dark Engine Port Manager" && Utilization__c <1.5
- Click Check Syntax.
- Click Save.
2. Update a Field Using a Flow
Let’s create a flow that will update the field, Status, to Complete when the field, Weapon Status, is assigned the value, Fully Functional.
- From Setup, type Flows in the Quick Find Box and open Flows.
- Click New Flow.
- Click Record-Triggered Flow, and then click Create.
- Enter the following in Configure Start:
- Object: Battle Station
- Configure Trigger: A record is created or updated
- Set Entry Conditions:
- Condition Requirements: All Conditions Are Met
- Field: Weapon_Status__c
- Operator: Equals
- Value: Fully Functional
- When to Run the Flow for Update Records: Only when a record is updated to meet the condition requirements
- Click Done.
A. Create an Update Record Action
Let’s add the action that updates the Status field’s value to Complete using the flow.
- Click
in the Flow Builder Canvas, and select Update Records.
- Enter the following for New Update Records:
- Label: Update Status
- For How to Find Records to Update and Set Their Values, select: Use the battle station record that triggered the flow
- For Set Field Values for the Battle Station Record, select:
- Field: Status__c
- Value: Complete
- Click Done.
B. Create a Post to Chatter Action
- Click
in the Flow Builder Canvas after the Update Status element.
- Click Actions.
- Enter the following:
- Action: Post to Chatter
- Label: Chatter Post
- Message: {!$Record.Name} is now complete and ready to operate! Witness the power of a fully armed battle station!
- Target Name or ID: {!$Record.Name.Id}
- Click Done.
- Click Save
- Enter Battle Station Complete for Flow Label. Click Save.
- Click Activate.
3. Test the App
From the App Launcher () , launch Battle Station Construction. How does it look so far? We can’t afford to make any dark mistakes.
- Try creating a Dark Engine Port Manager resource record, and the following error message should appear.
- Test the flow by updating the field, Weapon Status, to Fully Functional. Did the field, Status update to Complete? If not, we are doomed.
Create Reports and Dashboards
The Battle Station Construction App includes the Reports and Dashboards tabs in addition to the Battle Stations, Resources, and Supplies tab. Let’s take advantage of those features to make the App more relevant.
1. Create a Report
Let’s create a simple report that displays the financial snapshot of the Battle Station. The Dark Lord needs it right away!
- From the App Launcher (
), launch Battle Station Construction.
- Open the Reports tab.
- Click New Report.
- Choose Battle Station with Supplies for Report Type.
- Click Start Report.
- Click Add Column to add the fields Quantity, Unit Cost, and Total Cost.
- Under Group Rows, click Add group and select Battle Station Name.
- Open the dropdown list next to the columns, Quantity and Unit Cost and click Summarize, then deselect Sum.
- Click Save & Run.
- For Report Name, enter Supplies Report.
- Click Save.
Depending on the record values, you should be left with a report similar to this:
2. Create a Dashboard
Let’s complete our App with a Dashboard to please the Dark Lord.
- From the App Launcher (
), launch Battle Station Construction.
- Open the Dashboards tab.
- Click New Dashboard.
- For Name, enter Supplies Dashboard. Then click Create.
- Click + Component to add a component.
- Select Supplies Report, and click Select.
- In Add Component, for Display As, select Vertical Bar Chart
- Click Add.
- Click Done and Save.
You should be left with a dashboard just like this:
Well, that’s it! Way to go! I hope we haven’t angered the Dark Lord.
0 Comments