layout | title | permalink |
---|---|---|
default |
How to setup your own environment to modify the application and propose a PR to the project? |
/development/ |
This guide will walk you through setting up a developer environment allowing you to deploy Org Check as your own unlocked package.
This page is also a good start if you want to participate in the project and propose your own PR o the team!
Before you begin, ensure you have the following:
- A development setup with two connected Salesforce orgs
- Salesforce CLI installed
First, clone the Org Check project repository from GitHub:
git clone https://github.com/SalesforceLabs/OrgCheck.git
cd OrgCheck
You need two developer orgs:
- Dev Hub Org: Enable Unlocked Packages and Second-Generation Managed Packages settings.
- Namespace Org: A single DevHub can link multiple namespaces, but a packaging project must be linked to one Namespace Org.
Log in to your Dev Hub org and enable the necessary settings.
- Go to App Launcher.
- Search for Namespace Registries.
- Click Link and sign in to your Namespace Org.
Edit the sfdx-project.json
file to specify the namespace:
{
"packageDirectories": [
{
"path": "<namespace>",
"default": true,
"package": "<namespace>",
"versionName": "Beryllium",
"versionNumber": "4.3.2.NEXT",
"versionDescription": "Org Check is an easy-to-install and easy-to-use Salesforce application in order to quickly analyze your org and its technical debt."
}
],
"namespace": "<namespace>",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "62.0"
}
Replace <namespace>
with your actual namespace.
Rename the force-app
folder to match your namespace name.
Update the OrgCheck_App_VFP.page
to point to your namespace as well:
<apex:page
<script>
Lightning.use('<namespace>:OrgCheck_App_Aura', function() {
$Lightning.createComponent('<namespace>:orgcheckApp', {});
});
</script>
</apex:page>
Replace <namespace>
with your actual namespace.
Create the package using the Salesforce CLI:
sf package create --name <namespace> --package-type Unlocked --path <namespace> --target-dev-hub <devhubalias>
Note the generated Package Id.
Create a package version with the generated Package Id:
sf package version create --package <namespace> --installation-key-bypass --wait 10 --target-dev-hub <devhubalias>
Note the Subscriber Package Version Id from the output.
If you want to use a scratch org, create it using:
sf org create scratch --definition-file orgs/dev.json --alias <scratchorgalias> --target-dev-hub <devhubalias> --wait 10
Deploy the package to your org using the Subscriber Package Version Id.
sf package install --package 04tDn0000011NpHIAU -u <scratchorgalias> -w 10
Alternatively, you can use the corresponding alias of the version id, which has been generated for you (on step 7) in the sfdx-project.json under the section packageAliases.
sf package install --package <namespace>@1.2.3.4 -u <scratchorgalias> -w 10
To debug, go to Setup in Salesforce:
- Navigate to Visualforce Pages.
- Look for
OrgCheck_App_VFP
. - Click Preview to view the page.
If you encounter any issues, check the following:
- Verify the Visualforce page is correctly pointing to your namespace.
- Ensure the namespace is correctly set in
sfdx-project.json
.
You should now have a fully working unlocked package of Org Check, using your own namespace. For further assistance, refer to the official documentation or reach out to the community. Happy coding!