1Check prerequisites
This guide deploys unmanaged Salesforce metadata. Your team can edit the components in your org and chooses when to apply updates. The source is available under the Apache 2.0 license.
- A test org. For a scratch org, you need a Dev Hub account that can create scratch orgs. For a sandbox, choose one that supports custom Apex, Metadata API deployments, and API 67.0 or later. Start in an org with no previous Portwood deployment.
- A deployment user with API access and permission to deploy metadata. A Salesforce system administrator can also assign the permission sets after deployment. Check Salesforce permissions.
- Translation Workbench. This release includes ten translations. In Setup, search for Translation Language Settings and enable Translation Workbench if needed. The scratch org definition enables Translation Workbench and the required language settings automatically.
- Git and Salesforce CLI on your computer. Install Git and the current Salesforce CLI. Open Terminal on macOS or Linux, or PowerShell on Windows. Run each line below and confirm both print a version.
git --version
sf --version
Already using the AppExchange package?
The managed app stores data in namespaced objects. A source deployment creates separate components and does not move existing templates, records, or automations. Keep the installed package in place and plan a migration separately if you need to retain that data.
2Clone the repository
Open a terminal in the folder where you keep projects. Clone the main branch, then enter the project folder.
git clone --branch main https://github.com/Portwood-Global-Solutions/Portwood.git
cd Portwood
Your clone includes manifest/package.xml. This file tells Salesforce which components make up the base DocGen app. Every deployment command below uses it. The optional Agentforce extension lives in its own directory.
Check Run git rev-parse HEAD and save the commit ID with your deployment notes. Keep this terminal in the Portwood folder and use the same files for testing and production.
3Connect a test org
Choose one option. Both give your test org the local nickname portwood-test, so you can copy the remaining commands as written. Choose an unused alias if that name already points to another org.
Create a fresh scratch org
A scratch org is a temporary Salesforce environment. Sign in to your Dev Hub through the browser. If your CLI already has a Dev Hub alias, skip sign-in and use that alias in place of portwood-hub.
sf org login web --instance-url https://login.salesforce.com --alias portwood-hub
From the Portwood folder, create the test org. The --no-namespace flag gives you the same unprefixed component names you’ll deploy in your own org. The Dev Hub provisions the org and the CLI signs you into it automatically.
sf org create scratch --definition-file config/project-scratch-def.json --no-namespace --target-dev-hub portwood-hub --alias portwood-test --duration-days 1 --wait 15
Save the org ID printed when creation succeeds. The org expires after one day. Choose a longer duration at creation if you need more time.
Use an existing sandbox
Sign in with your sandbox administrator account and approve access. If your company requires single sign-on through My Domain, replace the URL with your sandbox’s My Domain URL.
sf org login web --instance-url https://test.salesforce.com --alias portwood-test
Confirm the destination
sf data query --target-org portwood-test --query "SELECT Id, IsSandbox, NamespacePrefix FROM Organization"
Check IsSandbox must be true. For a scratch org, match the ID to the creation output and confirm NamespacePrefix is blank. For a sandbox, match the ID to Setup → Company Information → Salesforce Organization ID. Salesforce may display only the first 15 characters of the 18-character ID.
4Validate and deploy
Dry run for an existing sandbox
In a fresh scratch org, go straight to Apply it to your test org below. That command also runs the tests. In an existing sandbox, review the manifest for names already used by custom work, such as TestDataFactory. A deployment can overwrite matching unmanaged components. Run this check first to compile the components and run the local Apex tests without saving changes.
sf project deploy start --manifest manifest/package.xml --target-org portwood-test --dry-run --test-level RunLocalTests --api-version 67.0 --wait 60
Apply it to your test org
For a fresh scratch org, run this once. For an existing sandbox, run it after the dry run reports Succeeded. Salesforce saves the components when the deployment and local Apex tests pass. This took about 17 minutes in our fresh scratch org.
sf project deploy start --manifest manifest/package.xml --target-org portwood-test --test-level RunLocalTests --api-version 67.0 --wait 60
Check Wait for Succeeded on the actual deployment. If the CLI returns a job ID while it is still running, check that job’s status before continuing.
5Verify with a PDF
Assign Portwood Admin to your signed-in deployment user. To let other people generate documents, assign Portwood User in Setup → Permission Sets → Manage Assignments.
sf org assign permset --name DocGen_Admin --target-org portwood-test
Add the default editable email templates (optional)
A source deployment skips the managed package’s post-install handler. Run the supplied script once if you want the default email template records available to edit. It preserves existing templates. Without these records, emails use their built-in text.
sf apex run --file scripts/seed-email-templates.apex --target-org portwood-test
Make a first document
Pick an Account you can use for the preview. If your test org needs a sample record, use the command below. Then open the org from your terminal.
Create a sample Account in the test org (optional)
sf data create record --sobject Account --values "Name='Portwood Guide Test Account' Phone='317-555-0142'" --target-org portwood-test
sf org open --target-org portwood-test
- In the test org, open Setup → Release Updates. If Salesforce offers Use Visualforce PDF Rendering Service with Apex Blob.toPdf(), follow its prompts to enable it.
- Open App Launcher → Portwood → My Templates → Create New → Start from a Blank Canvas. Name the template. Enter
Accountin Base Object, select the standard Account if suggestions appear, then choose Create & Open Canvas. - Open Data. Under Preview with this record, type the first few letters of the Account name and select it from the results. Confirm Account Name is included, then choose Done.
- Choose Text and click the white page to place a box. In the Content editor, replace the starter text with
Customer: {Name}. Drag the box’s right edge wider if needed. Select Save, wait for Saved as a new version, then choose Preview.
Success The PDF opens and shows your test Account’s actual name. See the illustrated walkthrough.
What we verified in a fresh scratch org
On November 22, 2026, we deployed v3.65.0 to an unnamespaced Developer Edition scratch org. Salesforce reported 539 components deployed and 2,309 Apex tests passed. We assigned both permission sets, seeded the 8 default email templates, and used the Portwood app to create an Account template and preview it. Open the PDF from that test.
For production, run the validation in step 6 against your own org. Its metadata, tests, and permissions contribute to that result.
6Deploy to production
Use the same checkout and manifest that passed in your test org. Check production’s permissions and language settings, review any same-name components, and back up affected metadata before your change window.
Confirm the production org
sf org login web --instance-url https://login.salesforce.com --alias portwood-prod
sf data query --target-org portwood-prod --query "SELECT Id, IsSandbox FROM Organization"
Use your production My Domain URL if required for sign-in. Confirm IsSandbox is false and the ID matches Company Information in your intended production org.
Validate in production
sf project deploy validate --manifest manifest/package.xml --target-org portwood-prod --test-level RunLocalTests --api-version 67.0 --wait 60
Wait for Succeeded and save the production validation job ID, which starts with 0Af. Salesforce checks component dependencies, local tests, and production coverage here.
Deploy the validated job
When you’re ready to apply the change, replace VALIDATION_JOB_ID with that production job ID. A successful validation is eligible for quick deploy for up to ten days. If it expires or you change the source, validate again.
sf project deploy quick --job-id VALIDATION_JOB_ID --target-org portwood-prod --wait 60
Finish After Succeeded, repeat the permission assignment and PDF check in production, using --target-org portwood-prod for each CLI command. Seed the editable email templates there if you use them.
Record the Git commit ID and the production deployment job ID. For an update, review the new source and its included manifest, test them together in your test org, and promote that same checkout.
Troubleshooting
The CLI returned a job ID. Did the deployment finish?
A wait timeout can return control while Salesforce continues working. Replace JOB_ID with the ID printed by the command. For a production job, use portwood-prod as the target.
sf project deploy report --job-id JOB_ID --target-org portwood-test
You can also open Setup → Deployment Status in the same org. Continue after the job shows Succeeded.
Salesforce reports a missing component, language, or test failure.
Open the failed job in Setup → Deployment Status → View Details. Start with the first component or Apex test error. For a missing class, tab, or asset, confirm that manifest/package.xml and force-app are from the same Git commit. For a language error, check Translation Workbench and the named language. Correct the cause and rerun validation in that org.
The terminal cannot find the project or manifest.
Run git rev-parse --show-toplevel to locate the clone. Open your terminal in the folder containing sfdx-project.json and force-app, and verify manifest/package.xml is present. If you downloaded an older tag, follow Clone the repository in a fresh folder. If sf itself is unrecognized, reopen the terminal after installing Salesforce CLI.
I can’t find Portwood in the App Launcher.
Check that the actual deploy succeeded in this org, then confirm your user has Portwood Admin under Setup → Users → Permission Set Assignments. Refresh Lightning and search the App Launcher again.
Salesforce CLI reference Deploy · Validate · Quick deploy