print Command Reference
The print command generates PDF documents from Dataverse records. It supports two primary modes:
- Single Record Mode - Export a single record using its entity type, record ID, and form configuration
- Plan Mode - Export comprehensive plans that aggregate data across a family group, including individuals, referrals, and activities within a date range
Authentication
The print command uses Service Principal (SPN) authentication to connect to Dataverse environments.
| Parameter | Alias | Required | Description |
|---|---|---|---|
--ClientId |
No | Application (client) ID for authentication. Defaults to the standard Navigator SPN. | |
--Secret |
No | Client secret for the service principal. Defaults to the standard Navigator SPN secret if not provided. | |
--EnvironmentUrl |
-e |
Yes | The Dataverse environment URL (e.g., https://org.crm6.dynamics.com). |
Operation Modes
The command supports three mutually exclusive operation modes:
| Parameter | Alias | Description |
|---|---|---|
--single |
-s |
Generate a PDF for a single record. |
--plan |
-p |
Generate a comprehensive plan PDF aggregating related data. |
--test |
-t |
Run in test mode to validate configuration without generating output. |
Single Record Parameters
When using --single mode, specify the record to export:
| Parameter | Alias | Required | Description |
|---|---|---|---|
--entity |
-n |
Yes | The logical name of the entity (e.g., mag_referral, contact). |
--recordid |
-r |
Yes | The GUID of the record to export. |
--formid |
-f |
No | The GUID of the form configuration to use for rendering. If not specified, uses the default main form. |
Plan Mode Parameters
When using --plan mode, specify the family group and filtering options:
| Parameter | Alias | Required | Description |
|---|---|---|---|
--recordid |
-r |
Yes | The GUID of the family group (mag_familygroup) record. |
--startdate |
No | Start date for filtering activities (format: yyyy-MM-dd). |
|
--enddate |
No | End date for filtering activities (format: yyyy-MM-dd). |
|
--individuals |
No | Comma-separated list of individual (contact) GUIDs to include. | |
--referrals |
No | Comma-separated list of referral GUIDs to include. | |
--activitytypes |
No | Comma-separated list of activity type codes to include. | |
--completedonly |
No | When set, only include completed activities. |
Output Options
| Parameter | Alias | Required | Description |
|---|---|---|---|
--output |
-o |
No | Output file path. If not specified, uses a default filename in the current directory. |
--overwrite |
No | Overwrite existing output file if it exists. |
Display Options
| Parameter | Alias | Description |
|---|---|---|
--verbose |
-v |
Enable verbose output with detailed processing information. |
--quiet |
Suppress non-essential output. | |
--debug |
-d |
Enable debug mode with maximum detail for troubleshooting. |
Usage Examples
Single Record Export
Export a referral record to PDF using a specific form configuration:
WhanauTahi.Xpm.Tooling.CLI print --single `
-e "https://myorg.crm6.dynamics.com" `
--Secret "your-client-secret" `
-n "mag_referral" `
-r "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d" `
-f "f1e2d3c4-b5a6-4c3d-9e8f-7a6b5c4d3e2f" `
-o "C:\Output\referral-export.pdf"
Plan Mode Export
Generate a comprehensive plan PDF for a family group with date filtering:
WhanauTahi.Xpm.Tooling.CLI print --plan `
-e "https://myorg.crm6.dynamics.com" `
--Secret "your-client-secret" `
-r "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d" `
--startdate "2024-01-01" `
--enddate "2024-12-31" `
--completedonly `
-o "C:\Output\family-plan.pdf" `
--verbose
Export with Specific Individuals and Referrals
Limit the plan export to specific individuals and referrals:
WhanauTahi.Xpm.Tooling.CLI print --plan `
-e "https://myorg.crm6.dynamics.com" `
--Secret "your-client-secret" `
-r "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d" `
--individuals "guid1,guid2,guid3" `
--referrals "guid4,guid5" `
-o "C:\Output\filtered-plan.pdf"
Test Mode
Validate configuration without generating output:
WhanauTahi.Xpm.Tooling.CLI print --test `
-e "https://myorg.crm6.dynamics.com" `
--Secret "your-client-secret" `
-n "mag_referral" `
-r "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d" `
-f "f1e2d3c4-b5a6-4c3d-9e8f-7a6b5c4d3e2f" `
--debug
Supported Content Types
The print command processes various content types from Dataverse records:
| Content Type | Description |
|---|---|
| Standard Fields | Text, number, date, optionset, and lookup fields from forms |
| Dynamic Assessments | Complex assessment data with nested structures |
| Images | Record images and attachments |
| Subgrids | Related record collections displayed in grids |
| Notes | Activity notes and annotations |
| Party Lists | Multi-party relationship fields |
| HTML Content | Rich text and HTML field content |
| Field Configurations | Custom field configuration data |
Architecture
The print command uses a modular architecture with specialised processors:
- PrintOrchestrator - Coordinates the overall export workflow
- DataverseService - Handles Dataverse API connections and data retrieval
- FormProcessor - Parses and processes form configurations
- PdfGenerator - Generates PDF output using QuestPDF
- Specialised Processors - Handle specific content types (assessments, images, etc.)
- Section Handlers - Process specific form sections (appointments, contact details, etc.)
Exit Codes
| Code | Description |
|---|---|
| 0 | Success - PDF generated successfully |
| 1 | Error - Check console output for details |
Troubleshooting
Common Issues
Authentication Errors
- Verify the
--Secretvalue is correct - Ensure the service principal has appropriate Dataverse permissions
- Check the
--EnvironmentUrlis correctly formatted
Missing Form Configuration
- Verify the
--formidGUID exists in the target environment - Ensure the form is published and active
Empty Output
- In plan mode, verify the date range contains activities
- Check that the specified individuals/referrals exist
- Use
--verboseor--debugfor detailed processing information
Permission Errors
- Ensure the service principal has read access to all required entities
- Verify table permissions for related records (activities, notes, images)