Skip to content
Suggest a correction

Install the demo in a scratch org

Getting started11 min read

Create a disposable Salesforce scratch org with the latest Record Health Check release, prepared sample records, and a card already on the Account record page. Every example Check has a known result in the demo data, so you can compare what the card shows with the expected results on this page.

The demo runs from the Record Health Check source repository and uses the Salesforce CLI. To try the package in an existing sandbox instead, follow Install Record Health Check in a sandbox.

You need:

  • Git, to copy the repository.
  • Node.js 22 with npm.
  • The Salesforce CLI (sf). The repository’s toolchain file lists the CLI version that the demo was verified with.
  • A Dev Hub: a Salesforce org that is allowed to create scratch orgs. In the Dev Hub, an administrator enables it in Setup → Dev Hub. A Developer Edition org can be a Dev Hub.
  • A CLI alias for the Dev Hub. An alias is a short name the CLI uses for an org. To create one, run sf org login web --set-default-dev-hub --alias my-dev-hub and sign in to the Dev Hub.

The demo uses one scratch org from the Dev Hub’s daily and active scratch org allocations. On Windows, run the commands in PowerShell, Command Prompt, or Git Bash.

  1. Copy the repository and install its tools:

    Terminal window
    git clone https://github.com/gkolan/record-health-check.git
    cd record-health-check
    npm ci
  2. Create the demo org, replacing my-dev-hub with your Dev Hub alias:

    Terminal window
    npm run setup -- --dev-hub my-dev-hub --alias rhc-demo

    --alias names the new scratch org. The command stops without changes if an org already uses that alias. Add --duration-days with a value from 1 to 7 to choose how long the org lasts; the default is 7.

The command takes several minutes. It:

  1. creates a scratch org without a namespace;
  2. installs the latest released Record Health Check package with Install for Admins Only;
  3. assigns Record Health Check Card User to you;
  4. deploys demo list views, a demo Account record page that shows the Example: Account Check Builder Guide card, and several test Check Sets, Apex classes, and triggers that the repository’s smoke tests use;
  5. creates the sample records, then checks that every example Check returns its expected result; and
  6. runs the repository’s subscriber smoke tests.

Result: The command ends with “Subscriber demo org is ready.” and prints the command to open the org.

If the command fails, read the last step it printed. If it failed after creating the scratch org and you do not need that org, delete it and run the command again with the same alias:

Terminal window
sf org delete scratch --target-org rhc-demo --no-prompt

Deleting a scratch org cannot be undone. Confirm the alias first.

Terminal window
sf org open --target-org rhc-demo --path "lightning/o/Account/list?filterName=RHC_Demo_Accounts"
  1. Open Acme Corporation. The Account page already has the Example: Account Check Builder Guide card.
  2. Select Run.
  3. Compare the summary with the expected result: 7 Passed, 5 Failed, 9 Warnings, 3 Info, and 1 Unable. The 17 Checks that do not pass appear as Failed, Warning, or Info according to their Failure Severity.

To try Example: Account Relationship & Risk on the same page, select the gear icon, then Edit Page, select the card, and change its Check Set property. Or drag a second Record Health Check component onto the page and select that Check Set for it. Save the page, return to Acme, and select Run.

The demo deploys extra Account Check Sets for its smoke tests, so the Account Check Set list contains more than the two examples. Choose the example by its label.

Step 3: Add the card to Contact and Opportunity pages

Section titled “Step 3: Add the card to Contact and Opportunity pages”

The setup command adds the card only to the Account page.

  1. Open the RHC Demo Contacts list view, and open Elena Hart (RHC Demo).
  2. Select the gear icon, then Edit Page.
  3. Search for Record Health Check in the Components panel, and drag the component onto the page. Because Example: Contact Relationship Readiness is the only active Contact Check Set, Lightning App Builder selects it automatically. Confirm the selection.
  4. Select Save, then Activate, and assign the page as the Org Default.
  5. Return to Elena Hart. The card runs when the page opens.
  6. Repeat these steps for RHC Demo Ready Deal from the RHC Demo Opportunities list view. The Example: Opportunity Deal Readiness Check Set is selected automatically.

Each row counts the results for one record. Fail includes every Failed, Warning, and Info row. The setup command verifies all 204 of these results when it creates the data.

Check SetRecordPassFailSkippedUnable
Example: Account Check Builder GuideAcme Corporation71701
Example: Account Check Builder GuideRHC Builder Ready Account22030
Example: Account Check Builder GuideRHC Builder Needs Review Account32200
Example: Account Check Builder GuideRHC Builder Empty Account93130
Example: Account Relationship & RiskAcme Corporation3410
Example: Account Relationship & RiskRHC Demo Ready Account8000
Example: Account Relationship & RiskRHC Demo Review Account0800
Example: Account Relationship & RiskRHC Builder Empty Account2330
Example: Contact Relationship ReadinessElena Hart (RHC Demo)8000
Example: Contact Relationship ReadinessMarcus Shaw (RHC Demo)7100
Example: Contact Relationship ReadinessMorgan Vale (RHC Demo)0800
Example: Contact Relationship ReadinessRiley Chen (RHC Demo)6200
Example: Opportunity Deal ReadinessRHC Demo Ready Deal8000
Example: Opportunity Deal ReadinessRHC Demo Review Deal0800
Example: Opportunity Deal ReadinessRHC Demo Closed Won6020
Example: Opportunity Deal ReadinessRHC Demo Closed Lost6020
Example: Opportunity Deal ReadinessRHC Demo Low Pipeline5300

Why some results are not Pass or Fail:

  • On Acme, Total proposal Amount matches total Product value is Unable to Check on purpose: Acme’s proposal has no Opportunity Products, so there is no Product total to compare.
  • On Acme, Channel partner governance is complete is Skipped because Acme’s Type is Customer, and the Check applies only to channel customers.
  • On the closed Opportunities, the primary-Contact and recent-activity Checks are Skipped because they apply only to open Opportunities.

Example: Account Check Builder Guide on Acme Corporation

Section titled “Example: Account Check Builder Guide on Acme Corporation”
OrderCheckResultWhy
10Account Type is setPassAcme’s Type is Customer.
20Account has a phone number or websitePassAcme has a Phone and a Website.
30Billing address matches the parent bill-to accountPassAcme’s billing address matches its parent Account’s.
40High-priority open Cases stay within the limitFailedAcme has 4 open High-priority Cases; the limit is 1.
50At least one open Opportunity is CommitInfoNo open Opportunity is in the Commit forecast category.
60Every open Case has a ContactFailed6 of the 12 open Cases have no Contact.
70Every escalated open Case has a DescriptionWarningThe escalated open Case has no Description.
80Every open Opportunity has an active ownerPassBoth open Opportunities have active owners.
90No proposal has a missing or low AmountPassThe proposal’s Amount is $600,000, above the $25,000 minimum.
100Open Opportunities include a Decision MakerPassOne Decision Maker Contact Role is on an open Opportunity.
110Contacts on open deals have Email or PhoneWarningOne Contact Role’s Contact has neither Email nor Phone.
120Open-deal Contact Roles include Technical BuyerInfoNo open-deal Contact Role is Technical Buyer.
130Cases closed keep pace with Cases createdWarning4 Cases closed and 16 were created in the last 30 days.
140Every won Opportunity has an AmountWarningThe won Opportunity has no Amount.
150Every proposal has a Next StepWarningThe proposal has no Next Step.
160Every proposal has a Primary Campaign SourceFailedThe proposal has no Primary Campaign Source.
170Open Opportunity Close Dates are in rangeInfoOnly 1 of the 2 open Opportunities closes within the next 180 days.
180Every open Opportunity has a Contact RoleFailedOnly 1 of the 2 open Opportunities has a Contact Role.
190Every won Opportunity has a primary ContactWarningThe won Opportunity has no primary Contact Role.
200New pipeline value covers recently lost valueFailedNew open pipeline is $600,000; value lost in the last 90 days is $760,000.
210Total proposal Amount matches total Product valueUnable to CheckThe proposal has no Opportunity Products to total.
220Sales and service share a Contact nameWarningNo Contact on an open Case is also a Contact Role on an open Opportunity.
230Sales Contact names cover priority Case ContactsWarningThe Contacts on High-priority Cases are not Contact Roles on open Opportunities.
240Open Opportunity names match those with ProductsWarningNeither open Opportunity has Products, so the two name lists do not match.
250Account activity meets the 60-day cadencePassTwo Tasks were completed on Acme in the last 60 days, which meets the minimum of two.

These Checks have no categories, so the card shows one summary. Account Check Builder Guide: configuration and results shows the configuration of every Check.

The data scripts create 8 Accounts, 51 Contacts, 19 Opportunities, 12 Opportunity Contact Roles, 6 Tasks, 20 Cases, 1 Campaign, 1 Product with a standard Price Book Entry, and 4 Opportunity Products. They also create a user named Jordan Blake, make Jordan the owner of Acme Corporation, and then deactivate Jordan, so that the owner Checks show an inactive owner. No Events are created.

Dates are relative to the day the scripts run, so calendar dates differ between runs while the results stay the same. The data uses one currency.

RecordWhat it demonstrates
Acme CorporationAn Account with many gaps: 38 Contacts, 6 without email, 16 Cases, two open Opportunities, and an inactive owner
RHC Builder Ready AccountEvery applicable Builder Guide Check passes
RHC Builder Needs Review AccountMost Builder Guide Checks fail
RHC Builder Empty AccountAn Account with no related records, which shows which Checks skip when there is nothing to check
RHC Demo Ready AccountEvery Account Relationship & Risk Check passes
RHC Demo Review AccountEvery Account Relationship & Risk Check fails
Elena Hart (RHC Demo)Every Contact Check passes
Marcus Shaw (RHC Demo)Only the recent-Task Check fails
Morgan Vale (RHC Demo)Every Contact Check fails
Riley Chen (RHC Demo)The bounced-email and recent-Task Checks fail, while Contact has Email or Phone passes
RHC Demo Ready DealEvery Opportunity Check passes
RHC Demo Review DealEvery Opportunity Check fails
RHC Demo Closed Won and Closed LostOpen-deal Checks skip on closed Opportunities
RHC Demo Low PipelineAn Opportunity with three gaps

To check the data and results again without changing anything, run the verification scripts from the repository folder:

Terminal window
sf apex run --target-org rhc-demo --file scripts/subscriber/data/verifyDemo.apex
sf apex run --target-org rhc-demo --file scripts/subscriber/data/verifyReadinessData.apex

Each script ends without an assertion error when the data and results match.

Test diagnostics as a user who is not an administrator

Section titled “Test diagnostics as a user who is not an administrator”

The demo assigns Record Health Check Card User to you, but a scratch org administrator can read everything. To see what a user with limited access sees, create a second user with access to the demo records, and assign Record Health Check Card User to that user.

To see diagnostic details as that user:

  1. Assign Record Health Check Diagnostics Viewer to the user directly, not through a Permission Set Group.
  2. In Setup → Custom Metadata Types → Record Health Check Set → Manage Records, edit the example Check Set and select Show Diagnostics.
  3. Open a record as the user and run the card.
  4. When you finish, clear Show Diagnostics and remove the Diagnostics Viewer assignment.

A scratch org expires at the end of its duration and its data is then deleted. To delete it sooner:

Terminal window
sf org delete scratch --target-org rhc-demo --no-prompt