Package Data 360 Functionality
Learning Objectives
After completing this unit, you’ll be able to:
- Describe the purpose of scratch orgs, Dev Hub orgs, and namespace orgs.
- Package and install Data 360 features using second-generation managed packaging.
Set Up Managed Packaging for Data 360
The Get Cloudy Consulting team has planned out their Data 360 project and are excited about the enhanced developer experience through 2GP. And they’re ready to do most of their development in their partner business org.
In this unit, you learn how to set up managed 2GP. Learn more about the process in Workflow for Data 360 Second-Generation Managed Packages.
Configure Dev Hub and Namespace Org
Get Cloudy needs a Dev Hub and a namespace org. A Dev Hub org is an org used to create, manage, and track scratch orgs and 2GP package versions. A namespace org is a Developer Edition org where you specify the namespace you’d like to use for your packages to ensure component prefix protection.
Here’s how to do it.
- In the partner business org, enable the Dev Hub and second-generation managed packaging.
- Create a namespace org, and define a namespace in that org.
- In the Dev Hub org, register the namespace.
Set Up Your Development Environment
Get Cloudy checks that it has the necessary development tools. If you’re new to developing in Salesforce, you must install Salesforce CLI, Visual Studio Code (VS Code), and the Salesforce Extension Pack for VS Code. Learn more about Salesforce Developer Experience by taking the Build Apps Together with Package Development trail, or learn more about these developer tools through the Set Up Your Workspace and Install Developer Tools trail.
Enable Data 360 for Scratch Orgs
Next, the Get Cloudy team needs to enable Data 360 for scratch orgs in their partner business org. This lets them use Data 360 metadata in scratch orgs or to package a data kit. A scratch org is a source-driven and disposable deployment of Salesforce code and metadata.
If Data 360 for scratch orgs isn’t enabled in your org, log a case with Salesforce Partner Support, and request that Data 360 for scratch orgs be enabled on your partner business org. Data 360 for scratch orgs is only available to scratch orgs associated with the Dev Hub in your partner business org.
Create a Project
In their local directory, Get Cloudy creates a Salesforce DX project.
sf project generate -n shoe-vendor-data360
Configure Project Files
- Open the project in VS Code and update key project files.
sfdx-project.json—Set the correct namespace and login URL.config/project-scratch-def.json—Define scratch org settings and feature flags..forceignore—Addssotto prevent standard system Data Model Objects from being retrieved into your source repository.
- In the
project-scratch-def.jsonfile, enable the required Data 360 settings and features. Here is a sampleproj-scratch-def.jsonfile that can be used.
{
"orgName": "Salesforce",
"edition": "Developer",
"features": [
"EnableSetPasswordInApi",
"CustomerDataPlatform",
"MarketingUser"
],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
},
"customerDataPlatformSettings": {
"enableCustomerDataPlatform": true
}
}
}Create a Scratch Org
To create the scratch org, Get Cloudy enters the following in their command line, making sure to specify the scratch org definition file:
sf org create scratch -a SCRATCH_ORG_NAME -f config/project-scratch-def.json -w 10 -v DEVHUB_ALIAS
Now that Get Cloudy has its scratch org created, the team can begin creating their data kit. In the next unit, you learn how to create a data kit with all the features you want, and then package it.
Resources
- Salesforce Developer: Create a Second-Generation Managed Package
- Salesforce Developer: Prepare to Distribute Your Second-Generation Managed Package
- Salesforce Developer Blog: Get Started with Modern AgentExchange Development
- Salesforce Developer: Workflow for Data 360 Second-Generation Managed Packages
- Trailhead: Second-Generation Managed Packages
