Search Results for

    Show / Hide Table of Contents

    organizationsetup - All DataSet

    DataSet Value: All

    The All DataSet option performs a complete environment setup, copying all reference data, system configuration, and master data from a template environment to a target environment. This is the most comprehensive configuration option, performing 40+ individual operations.

    When to Use

    Use the All DataSet when:

    ✅ Setting up a brand new Navigator environment from scratch
    ✅ Establishing a new development, test, or production environment
    ✅ Performing complete environment configuration after initial deployment
    ✅ Restoring all reference data after a major environment change
    ✅ Creating a new environment that needs all standard Navigator configuration

    Do not use when:

    ❌ Only updating specific configuration areas (use targeted DataSet options instead)
    ❌ Target environment already has customised reference data you want to preserve (use specific DataSet with caution)
    ❌ You only need outcomes framework (use OutcomesFramework instead)

    Command Syntax

    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://target.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All"
    

    How It Works

    Operation Sequence

    The All DataSet executes operations in a specific order to handle dependencies correctly:

    1. Access & Identity Setup
       ├── Enable AutoCreateAccessTeams on entities
       ├── Create team templates (3 templates)
       └── Create standard teams (Intake Team)
    
    2. System Configuration
       ├── Copy system configuration records
       └── Copy autonumber configuration
    
    3. Reference Data - Basic
       ├── Assessment tools
       ├── Age groups
       ├── Ethnicities
       ├── Tribes and sub-tribes
       ├── Gathering places
       ├── Education levels
       ├── Consent types
       ├── Employment statuses
       ├── Autotexts
       ├── Activity groups
       └── Exit reason mappings
    
    4. PRIMHD Configuration
       ├── PRIMHD settings
       ├── PRIMHD activities
       ├── PRIMHD referral codes
       └── PRIMHD teams
    
    5. Contract & Service Setup
       ├── Contract grouping (2-pass operation)
       ├── Funding contract types
       ├── Funding contracts
       ├── Contract services
       └── Service eligibility rules
    
    6. Outcomes Framework
       ├── Outcome domains
       ├── Domain indicators
       ├── Outcome areas
       ├── Outcome categories
       ├── Domain-area relationships
       ├── Area-category relationships
       ├── Predefined outcomes
       └── Predefined outcome activities
    

    Access Team Configuration

    The command configures access teams on three core entities:

    Entities Modified:

    • contact - Individual records
    • mag_familygroup - Family group records
    • mag_plan - Plan records

    Action: Enables AutoCreateAccessTeams metadata property

    Team Templates Created:

    Template Name GUID Purpose
    Individual Team Template 8F1D681D-B770-E711-810F-000C2975F09B Auto-created teams for contact records
    Family Group Team Template 1EFF884E-C070-E711-810F-000C2975F09B Auto-created teams for family group records
    Plan Team Template 7D42E7A9-5568-E711-8108-000C2975F09B Auto-created teams for plan records

    Settings:

    • defaultaccessrightsmask: 262167 (Read, Write, Append, Append To)
    • Metadata changes trigger customisation publish

    ⚠️ CRITICAL: These GUIDs are hard-coded in the Navigator codebase and must never be changed. Modifying them will break team functionality across the platform.

    Standard Team Creation

    Team Created:

    • Name: "Intake Team"
    • GUID: C030632C-D4D4-4F3C-9E3F-7452D834834A ⚠️ DO NOT CHANGE
    • Type: Owner team (teamtype = 0)
    • Administrator: Set to current user (from WhoAmI)
    • Business Unit: Set to current user's business unit

    System Configuration Records

    Table: mag_sysconfig

    Purpose: System-wide configuration settings controlling Navigator behavior

    Fields Copied:

    • mag_name - Configuration key name (primary identifier)
    • mag_value - Configuration value
    • mag_key - Additional key field
    • mag_description - Configuration description
    • mag_image - Binary image data (if present)

    Special Handling:

    • GUIDs are not preserved (name-based uniqueness)
    • addToExistingData = true - Allows adding new configuration values
    • Can include binary data in mag_image field

    Autonumber Records

    Table: wtl_autonumber

    Purpose: Defines automatic numbering sequences for entities

    Fields Copied:

    • wtl_name - Autonumber configuration name
    • wtl_autonumbertype - Type of numbering
    • wtl_entityschemaname - Target entity schema name
    • wtl_fieldschemaname - Target field schema name
    • wtl_staticprefix - Static prefix for generated numbers
    • wtl_numberlength - Length of numeric portion
    • wtl_overwriteenabled - Allow overwriting existing values
    • wtl_concantenateschemanames - Schema names to concatenate
    • wtl_format - Custom format string
    • wtl_formatparameters - Format parameters
    • wtl_limitto - Limit numbering to specific records
    • wtl_primaryfield - Primary field reference

    Special Handling:

    • wtl_currentposition is always set to 0 in target (never copied)
    • GUIDs are not preserved (name-based uniqueness)
    • addToExistingData = true - Allows adding new autonumber configurations

    ⚠️ WARNING: Current position reset prevents number conflicts but means numbering starts at 0 in target environment.

    Assessment Tools

    Table: mag_assessmenttype

    Purpose: Defines assessment types available in Navigator

    Fields Copied:

    • mag_name - Assessment tool name
    • mag_datacollectionmethod - Collection method (e.g., form-based, external)
    • mag_entitylogicalname - Entity storing assessment data
    • mag_prefix - Prefix for assessment records
    • mag_formname - Form used for data entry

    State Fields:

    • When creating new: statecode = 1 (Inactive), statuscode = 809730000
    • When updating: Copies state from source

    ⚠️ CRITICAL: Assessment tools are intentionally created inactive. Users must manually activate each assessment tool, which triggers the creation of required plugin steps. Do not modify this behavior.

    Best Practice: After running organizationsetup, review and manually activate only the assessment tools required for the target environment.

    Reference Data Tables

    The following reference data tables are copied with standard processing:

    Age Groups

    Table: mag_agegroup

    Fields:

    • mag_agegroupid - Preserved GUID
    • mag_name - Age group name
    • mag_minimumage - Minimum age in range
    • mag_maximumage - Maximum age in range

    Ethnicities

    Table: mag_ethnicity

    Fields:

    • mag_name - Ethnicity name
    • mag_ethnicitycode - Official ethnicity code
    • mag_priority - Display priority
    • mag_level - Hierarchical level
    • mag_visible - Visibility flag

    Tribes and Sub-Tribes

    Table: mag_tribe, mag_subtribe

    Tribe Fields:

    • mag_tribeid - Preserved GUID
    • mag_name - Tribe name
    • mag_iwicode - Official iwi code
    • statecode, statuscode - State information

    Sub-Tribe Fields:

    • mag_subtribeid - Preserved GUID
    • mag_name - Sub-tribe name
    • mag_subtribecode - Sub-tribe code
    • mag_tribe - Parent tribe reference (resolved by name)
    • statecode, statuscode - State information

    Special Handling: Sub-tribes resolve parent tribe references by looking up tribe name in target environment.

    Gathering Places

    Table: mag_gatheringplace

    Fields:

    • mag_gatheringplaceid - Preserved GUID
    • mag_name - Place name
    • mag_address_street1/2/3 - Street address lines
    • mag_address_city - City
    • mag_address_country - Country
    • mag_address_postcode - Postal code

    Education Levels

    Table: mag_levelofeducation

    Fields:

    • mag_levelofeducationid - Preserved GUID
    • mag_name - Education level name
    • mag_description - Level description

    Consent Types

    Table: mag_consenttype

    Fields:

    • mag_name - Consent type name
    • mag_subtype - Consent subtype option
    • statecode, statuscode - State information

    Special Handling:

    • Includes verbose console logging showing source/target counts
    • addToExistingData controlled by command flag

    Employment Statuses

    Table: mag_employmentstatus

    Fields:

    • mag_name - Employment status name
    • statecode, statuscode - State information

    Autotexts

    Table: mag_autotext

    Purpose: Pre-defined text snippets for rapid data entry

    Fields:

    • mag_name - Autotext name/trigger
    • mag_text - Expanded text content
    • statecode, statuscode - State information

    Special Handling: addToExistingData = true - Allows adding new autotexts to existing sets

    Activity Groups

    Table: mag_activitygroup

    Fields:

    • mag_name - Activity group name
    • mag_search1/2/3 - Search/filter keywords
    • mag_description - Group description
    • statecode, statuscode - State information

    Exit Reason Mappings

    Table: mag_exitreasonmapping

    Purpose: Maps internal exit reasons to external reporting codes

    Fields:

    • mag_name - Mapping name
    • mag_wtnexitreason - Whānau Tahi Navigator exit reason code

    PRIMHD Configuration

    PRIMHD (Primary Mental Health and Addiction Data) configuration tables support mental health and addiction service reporting in New Zealand.

    PRIMHD Settings

    Table: mag_primhdsetting

    Fields:

    • mag_primhdsettingid - Preserved GUID
    • mag_name - Setting name
    • mag_code - PRIMHD code
    • mag_codename - Code display name
    • mag_description - Setting description
    • mag_codevalidfrom - Code valid from date
    • mag_codevalidto - Code valid to date
    • mag_localcode - Local code flag

    PRIMHD Activities

    Table: mag_primhdactivity

    Fields:

    • mag_primhdactivityid - Preserved GUID
    • mag_name - Activity name
    • mag_code - PRIMHD activity code
    • mag_codename - Code display name
    • mag_description - Activity description
    • mag_codevalidfrom - Code valid from date
    • mag_codevalidto - Code valid to date
    • mag_localcode - Local code flag
    • mag_familyinvolved - Family involvement option

    PRIMHD Referral Codes

    Table: mag_referralcode

    Primary Field: mag_code (unique identifier)

    Fields:

    • mag_referralcodeid - Preserved GUID
    • mag_code - Primary code identifier
    • mag_referralcode - Referral code value
    • mag_referralcodetypecode - Code type option
    • mag_referralcodename - Code display name
    • mag_description - Code description
    • mag_codevalidfrom - Code valid from date
    • mag_codevalidto - Code valid to date

    PRIMHD Teams

    Table: mag_primhdteam

    Fields:

    • mag_primhdteamid - Preserved GUID
    • mag_name - Team name
    • mag_teamname - Team display name
    • mag_primhdteamcode - PRIMHD team code
    • mag_description - Team description

    Contract & Service Configuration

    Contract Grouping

    Table: mag_grouping

    Purpose: Hierarchical grouping structure for organising contracts

    Fields:

    • mag_name - Group name
    • mag_grouptypecode - Group type option
    • mag_displayorder - Sort order
    • mag_parentgroupingid - Parent group reference

    Special Handling - Two-Pass Processing:

    First Pass:

    1. Creates all group records without parent references
    2. Console: "First pass - Creating groups..."
    3. Allows hierarchy to be established

    Second Pass:

    1. Updates parent references after all groups exist
    2. Console: "Second pass - Setting parent references..."
    3. Resolves parent group references by name lookup
    4. Always uses updateExisting = true for second pass

    Console Output:

    • U = Parent reference updated
    • - = No parent reference to set

    This two-pass approach ensures hierarchical data is created correctly even when parent groups are defined after children in the source data.

    Funding Contract Types

    Table: mag_contracttype

    Fields:

    • mag_name - Contract type name
    • mag_description - Type description
    • statecode, statuscode - State information

    Special Handling: addToExistingData = true - Allows new contract types to be added

    Funding Contracts

    Table: mag_fundingcontract

    Fields:

    • mag_name - Contract name
    • mag_agreementnumber - Agreement/contract number
    • mag_shortname - Short name
    • mag_riskstatuscode - Risk status option
    • mag_providerid - Provider identifier
    • Date fields: mag_startdate, mag_enddate, mag_signeddate, mag_exitclausedate
    • mag_description - Contract description

    EntityReference Fields (Resolved):

    • mag_contracttypeid - Contract type (by mag_name)
    • mag_collectiveorgroupid - Collective/group (by mag_name)
    • mag_parentfundingcontractid - Parent contract (by mag_name)
    • mag_relationshipcontact - Relationship contact (by fullname)
    • mag_financecontact - Finance contact (by fullname)
    • mag_reportingcontact - Reporting contact (by fullname)
    • mag_contractmanagerid - Contract manager (by fullname)
    • mag_servicemanagerid - Service manager (by fullname)

    Date Validation:

    • Dates before January 1, 1850 are set to null
    • Prevents invalid/corrupted dates from being copied

    Contract Services

    Table: mag_contractservice

    Fields:

    • mag_name - Service name
    • mag_shortname - Short name
    • Service configuration: mag_allowoneclicksendaccept, mag_budgetedhours, mag_duplicatereferrals, mag_maximumreferrallimit, mag_ishardlimit
    • Eligibility: mag_eligibilityrequirement, mag_ageeligibilitybasis, mag_othereligibility, mag_eligibility, mag_exclusion
    • Assessment flags: mag_requirepartialadom, mag_requirefreeformmentalstateexamination
    • Reporting: mag_primhdreportingrequired, mag_iris, mag_vinah, mag_vaed
    • Tracking: mag_timetracking, mag_traveltimetracking
    • Dates: mag_startdate, mag_enddate
    • Text: mag_description, mag_staffingrequirements

    EntityReference Fields (Resolved):

    • mag_contractid - Parent funding contract (by mag_name)
    • mag_contractservicesite - Service site (by mag_name)
    • mag_contractservicetypeid - Service type (by mag_name)
    • mag_approvalsmanager - Approvals manager (by fullname)
    • mag_servicecoordinatorid - Service coordinator (by fullname)
    • mag_groupcollectiveid - Group/collective (by mag_name)

    Date Validation: Same as funding contracts (dates before 1850 set to null)

    Service Eligibility Rules

    Table: mag_eligibilityrule

    Purpose: Defines who is eligible for specific contract services

    Primary Key: Composite key of mag_eligibilityrulename + mag_contractserviceid

    Fields:

    • mag_eligibilityruleid - Preserved GUID (when not updating)
    • mag_eligibilityrulename - Rule name
    • mag_requirementlevel - Requirement level option
    • Age criteria: mag_minimumage, mag_maximumage
    • Demographics: mag_gender, mag_ethnicity, mag_tribe
    • Geographic: mag_areablock
    • Other: mag_cscscheck - CSCS check required flag

    EntityReference Fields (Resolved):

    • mag_contractserviceid - Contract service (by mag_name)
    • mag_ethnicity - Ethnicity requirement (by mag_name)
    • mag_tribe - Tribe requirement (by mag_name)
    • mag_areablock - Area block (by mag_areablock)

    ⚠️ SPECIAL HANDLING: This table uses a composite key. Multiple rules can have the same name if they're associated with different contract services. The command's special logic in EntityHelper.CreateIfNew handles this correctly.

    Console Output:

    • Verbose logging shows contract service name resolution
    • "Checking eligibility rule with name: [name] and contract service ID: [id]"
    • "Creating new eligibility rule" or "Updating existing eligibility rule"

    Outcomes Framework

    Outcome Domains

    Table: mag_domain

    Purpose: Top-level categorisation of outcomes (e.g., Health, Education, Employment)

    Fields:

    • mag_name - Domain name
    • mag_outcomemap - Outcome mapping option
    • statecode, statuscode - State information

    Domain Indicators

    Table: mag_outcomedomainindicator

    Purpose: Measurable indicators within outcome domains

    Fields:

    • mag_name - Indicator name
    • mag_indicatorcode - Indicator code
    • mag_outcomedomain - Parent domain reference (resolved by mag_name)
    • statecode, statuscode - State information

    Special Handling:

    • Resolves parent domain by name
    • Console: "Could not resolve domain reference for indicator: [name]" if parent not found
    • Returns false if parent domain cannot be resolved

    Outcome Areas

    Table: mag_outcomearea

    Purpose: Specific outcome areas within domains

    Fields:

    • mag_name - Area name
    • statecode, statuscode - State information

    Outcome Categories

    Table: mag_outcomecategory

    Purpose: Detailed categorisation within outcome areas

    Fields:

    • mag_name - Category name
    • statecode, statuscode - State information

    Domain-Area Relationships

    Table: mag_mag_outcomearea_mag_domain

    Purpose: Many-to-many relationships between domains and areas

    Primary Field: mag_mag_outcomearea_mag_domainid (relationship record ID)

    Fields:

    • mag_domainid - Domain EntityReference
    • mag_outcomeareaid - Outcome area EntityReference

    Processing Logic:

    1. Retrieves source domain and area GUIDs from relationship record
    2. Looks up domain and area names in template environment
    3. Finds matching domain and area in target by name
    4. Creates new relationship using target EntityReferences

    Console Output:

    • "Source: Domain '[name]' - Area '[name]'"
    • "Creating relationship in target between [domain] and [area]"
    • Error messages if resolution fails

    Special Handling: Verbose logging helps troubleshoot relationship creation issues.

    Area-Category Relationships

    Table: mag_mag_outcomecategory_mag_outcomearea

    Purpose: Many-to-many relationships between areas and categories

    Primary Field: mag_mag_outcomecategory_mag_outcomeareaid (relationship record ID)

    Fields:

    • mag_outcomeareaid - Outcome area EntityReference
    • mag_outcomecategoryid - Outcome category EntityReference

    Processing Logic: Same pattern as domain-area relationships

    Console Output:

    • "Source IDs - Area: [id], Category: [id]"
    • "Source: Area '[name]' - Category '[name]'"
    • "Target IDs - Area: [id], Category: [id]"
    • "Creating relationship in target between [area] and [category]"

    Predefined Outcomes

    Table: mag_predefinedoutcome

    Purpose: Template outcomes that can be added to plans

    Fields:

    • mag_predefinedoutcomeid - Preserved GUID
    • mag_name - Outcome name
    • mag_outcomename - Display name
    • mag_pdbnumber - PDB number
    • mag_description - Outcome description
    • Duration: mag_duration, mag_stdduration
    • mag_createfromreferral - Auto-create flag

    EntityReference Fields (Resolved by mag_name):

    • mag_activitydefaultservice - Default service
    • mag_service - Associated service
    • mag_analysis1, mag_analysis2, mag_analysis3 - Analysis fields
    • mag_domain1, mag_domain2, mag_domain3 - Associated domains
    • mag_outcomearea1, mag_outcomearea2, mag_outcomearea3 - Associated areas
    • mag_outcomecategory1, mag_outcomecategory2, mag_outcomecategory3 - Associated categories

    Special Handling: Custom PredefinedOutcomeWriter handles multiple domain/area/category references.

    Predefined Outcome Activities

    Table: mag_predefinedactivity

    Purpose: Template activities linked to predefined outcomes

    Primary Key: Composite key of mag_name + mag_service

    Fields:

    • mag_name - Activity name
    • mag_summary - Activity summary
    • mag_pdanumber - PDA number
    • mag_message - User message
    • Boolean flags: mag_familygroupactivity, mag_createbackdatedactivity, mag_requiredforenrolment, mag_enrolment, mag_clientfacing, mag_globalenrolment
    • Options: mag_activitytype, mag_assessmenttype, mag_who, mag_startafterfrom, mag_startaftertype, mag_dueaftertype, mag_startat, mag_referralstagetogenerate
    • Timing: mag_startafter, mag_dueafter

    EntityReference Fields (Resolved by mag_name):

    • mag_service - Associated contract service
    • mag_predefinedoutcome - Parent predefined outcome
    • mag_assessmenttool - Associated assessment tool
    • mag_consenttype - Required consent type
    • mag_dynamicassessmenttemplate - Assessment template
    • mag_activitygroup1a, mag_activitygroup2a, mag_activitygroup3a - Activity groups

    ⚠️ SPECIAL HANDLING: Uses composite key (name + service). Multiple activities can have the same name if associated with different services. Custom logic in EntityHelper.CreateIfNew handles this.

    Console Output:

    • "Checking predefined activity with name: [name] and service ID: [id]"
    • "Retrieved mag_name: [service name]"
    • "Creating new predefined activity" or "Updating existing predefined activity"

    Contract Service Types and Sites

    These tables support the ServiceTransfer DataSet but are also used in All:

    Contract Service Types

    Table: mag_contractservicetype

    Fields:

    • mag_name - Service type name

    Note: Simple lookup table with minimal fields

    Contract Service Sites

    Table: mag_contractservicesite

    Fields:

    • mag_name - Site name
    • mag_code - Site code
    • statecode, statuscode - State information

    Real-World Scenarios

    Scenario 1: New Production Environment

    Context: Deploying Navigator to a new production environment for the first time.

    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://newprod.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --Secret "your-secret-here" `
        --DataSet "All"
    

    Expected Console Output:

    Navigator environment prepration tool
    Master Data: Whānau Tahi Master Data
    Target System: Production Environment
    Access teams ... done
    Standard teams ... done
    System config records ...+++++... done
    Autonumber records ...+++... done
    Assessment tools ...++++++... done
    Age Groups ...+++++... done
    Ethnicities ...++++++++++... done
    ...
    Environment preparation completed
    

    Post-Setup Tasks:

    1. Review and activate required assessment tools
    2. Verify team templates created correctly
    3. Confirm access teams enabled on core entities
    4. Test autonumber sequences

    Scenario 2: Development Environment Refresh

    Context: After refreshing dev from production, need to restore dev-specific reference data.

    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://devmasterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://refresheddev.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All" `
        --AddToExistingData `
        --UpdateExisting
    

    Why this works:

    • AddToExistingData allows operations even though production data exists
    • UpdateExisting updates records to match dev master data values
    • Dev-specific assessment tools, autotexts, and test data restored

    Console Output:

    ...
    System config records ...UUU++U... done
    Autonumber records ...UUU... done
    ...
    
    • U = Records updated to dev values
    • + = New dev-specific records added
    • - = Records unchanged

    Scenario 3: Complete Environment Rebuild

    Context: Environment corruption requires complete configuration rebuild.

    Steps:

    1. Back up business data (contacts, referrals, plans - not reference data)

    2. Delete all reference data from target environment (or use fresh environment)

    3. Run organizationsetup:

    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://cleanenv.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All"
    
    1. Verify configuration:

      • Check team templates GUIDs match expected values
      • Confirm assessment tools are inactive
      • Review autonumber starting positions (should be 0)
    2. Restore business data if needed

    Scenario 4: Synchronised Multi-Environment Setup

    Context: Need dev, test, and UAT environments with identical reference data.

    Strategy: Use same master data environment for all targets

    # Configure Dev
    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://dev.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All"
    
    # Configure Test
    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://test.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All"
    
    # Configure UAT
    .\WhanauTahi.Xpm.Tooling.exe organizationsetup `
        --MasterDataUrl "https://masterdata.crm6.dynamics.com" `
        --EnvironmentUrl "https://uat.crm6.dynamics.com" `
        --ClientId "12345678-1234-1234-1234-123456789abc" `
        --DataSet "All"
    

    Result: All three environments have identical reference data, reducing environment-specific issues during promotion.

    Performance Considerations

    Typical Execution Time

    Complete All DataSet: 5-10 minutes

    Breakdown by phase:

    • Access & Identity: 10-30 seconds
    • System Configuration: 30-60 seconds
    • Reference Data: 2-3 minutes
    • PRIMHD Configuration: 1-2 minutes
    • Contract & Services: 1-2 minutes
    • Outcomes Framework: 1-2 minutes

    Factors affecting duration:

    • Network latency between environments
    • Volume of master data (contracts, services, outcomes)
    • Target environment database performance
    • Use of UpdateExisting flag (slower than create-only)

    Optimisation Tips

    For faster execution:

    1. Run during off-peak hours (less database contention)
    2. Ensure good network connectivity between environments
    3. Use AddToExistingData=false when possible (skips early)
    4. Consider targeted DataSet options if only partial config needed

    For large master data sets:

    • Monitor console output for progress
    • Look for operations taking unusually long (may indicate issues)
    • Break into smaller operations if command times out

    Troubleshooting

    Access Team Configuration Fails

    Problem: "Could not enable AutoCreateAccessTeams on [entity]"

    Cause: Permissions issue or entity doesn't support access teams

    Solution:

    1. Verify ClientId has "System Administrator" role in target
    2. Check entity supports access teams (contact, mag_familygroup, mag_plan should)
    3. Review any customisation errors in environment

    Team Template GUID Mismatch

    Problem: Team template created with different GUID than expected

    Cause: Code or configuration attempting to modify hard-coded GUIDs

    Solution:

    1. DO NOT modify the hard-coded GUIDs in source code
    2. Delete incorrectly created team templates
    3. Re-run organizationsetup with unmodified code
    4. Verify GUIDs match expected values after completion

    Assessment Tools Not Appearing

    Problem: Assessment tools copied but not visible in environment

    Cause: Assessment tools created in inactive state (by design)

    Solution:

    1. Navigate to assessment tools in target environment
    2. Manually activate required assessment tools
    3. Activation triggers plugin step registration
    4. This is expected behavior - not a bug

    Autonumber Conflicts

    Problem: Autonumber sequences conflict with existing records

    Cause: wtl_currentposition reset to 0, existing records have higher numbers

    Solution:

    1. Manually set wtl_currentposition to max existing value + 1
    2. Or delete existing autonumber records before running organizationsetup
    3. Or allow system to auto-increment past existing records

    Contract Service Eligibility Rules Duplicated

    Problem: Multiple eligibility rules with same name created

    Cause: Composite key allows same name with different contract services (intended behavior)

    Solution:

    • This is expected for rules applying to multiple services
    • Review rule names and associated services
    • If truly duplicate (same name + same service), investigate source data

    Date Fields Set to Null

    Problem: Contract/service dates showing as null after copy

    Cause: Source dates were before January 1, 1850 (invalid data)

    Solution:

    1. Check source data for invalid dates
    2. Correct invalid dates in master data environment
    3. Re-run organizationsetup with UpdateExisting flag
    4. Dates after 1850 will copy correctly

    Relationship Creation Fails

    Problem: "Could not resolve [entity] reference" during relationship creation

    Cause: Parent entities don't exist in target

    Solution:

    1. Ensure prerequisite operations completed successfully
    2. Check that domains exist before creating domain-area relationships
    3. Check that areas exist before creating area-category relationships
    4. Review console output for errors in earlier operations
    5. Run All DataSet to ensure correct operation order

    Grouping Parent References Missing

    Problem: Contract groups created but parent references not set

    Cause: Second pass of grouping operation failed

    Solution:

    1. Check console output for second pass errors
    2. Verify parent groups exist in target
    3. Confirm parent groups exist in master data
    4. Re-run with UpdateExisting to retry parent reference updates

    Tables Affected

    The All DataSet affects the following 50+ tables:

    Access & Identity

    • contact (metadata only - AutoCreateAccessTeams enabled)
    • mag_familygroup (metadata only - AutoCreateAccessTeams enabled)
    • mag_plan (metadata only - AutoCreateAccessTeams enabled)
    • teamtemplate (3 records created)
    • team (1 record created)

    System Configuration

    • mag_sysconfig
    • wtl_autonumber

    Reference Data

    • mag_assessmenttype
    • mag_agegroup
    • mag_ethnicity
    • mag_tribe
    • mag_subtribe
    • mag_gatheringplace
    • mag_levelofeducation
    • mag_consenttype
    • mag_employmentstatus
    • mag_autotext
    • mag_activitygroup
    • mag_exitreasonmapping

    PRIMHD

    • mag_primhdsetting
    • mag_primhdactivity
    • mag_referralcode
    • mag_primhdteam

    Contracts & Services

    • mag_grouping
    • mag_contracttype
    • mag_fundingcontract
    • mag_contractservice
    • mag_contractservicetype
    • mag_contractservicesite
    • mag_eligibilityrule

    Outcomes Framework

    • mag_domain
    • mag_outcomedomainindicator
    • mag_outcomearea
    • mag_outcomecategory
    • mag_mag_outcomearea_mag_domain (relationship table)
    • mag_mag_outcomecategory_mag_outcomearea (relationship table)
    • mag_predefinedoutcome
    • mag_predefinedactivity

    Total: 35+ tables plus 3 metadata-only entity modifications

    Best Practices

    Master Data Environment Management

    Establish a master data environment:

    1. Create dedicated environment for reference data templates
    2. Document all reference data values
    3. Use change control process for updates
    4. Version control configuration changes
    5. Test changes before propagating to other environments

    Master data content:

    • Approved ethnicities, tribes, education levels
    • Standard outcomes framework
    • Template contracts and services (if using ServiceTransfer)
    • Assessment tool configurations
    • System configuration values

    Update workflow:

    1. Make changes to master data environment
    2. Document changes (what, why, when)
    3. Test in dev environment first
    4. Propagate to test/UAT using organizationsetup
    5. Schedule production update during maintenance window

    Pre-Flight Checklist

    Before running All DataSet:

    ✅ Verify both environments accessible
    ✅ Confirm ClientId has System Administrator role in both environments
    ✅ Back up target environment (if using UpdateExisting)
    ✅ Document current state of target environment
    ✅ Verify master data environment contains approved values
    ✅ Review assessment tools to be copied (which should be activated?)
    ✅ Check for active users in target environment (coordinate timing)
    ✅ Plan for manual steps (activate assessment tools, verify GUIDs)

    Post-Setup Verification

    After running All DataSet:

    Immediate checks: ✅ Review console output for errors or warnings
    ✅ Verify team template GUIDs match expected values
    ✅ Check access teams enabled on contact, family group, plan entities
    ✅ Confirm Intake Team created with correct GUID

    Assessment tools: ✅ Navigate to assessment tools in target environment
    ✅ Identify which tools are required for this environment
    ✅ Manually activate required assessment tools
    ✅ Test assessment tool functionality

    Autonumber sequences: ✅ Review autonumber configurations
    ✅ Verify starting positions (should be 0 for new environments)
    ✅ Test number generation on sample records

    Reference data spot checks: ✅ Verify key ethnicities, tribes present
    ✅ Check age group ranges
    ✅ Review gathering places (if used)
    ✅ Confirm consent types available

    Outcomes framework: ✅ Verify outcome domains present
    ✅ Check domain-area relationships exist
    ✅ Review predefined outcomes
    ✅ Test creating plan with predefined outcome

    Contracts & services (if applicable): ✅ Verify funding contracts copied
    ✅ Check contract services present
    ✅ Review eligibility rules
    ✅ Test referral creation to contract service

    Incremental Updates Strategy

    For ongoing reference data maintenance:

    1. Don't use All for updates - Use targeted DataSet options:

      • Outcomes changes: Use OutcomesFramework
      • Service changes: Use ServiceTransfer
      • Specific table changes: Consider datamanipulation commands
    2. Use UpdateExisting flag selectively:

      • Only when intentionally updating existing records
      • Test in dev first
      • Document which records will change
    3. Coordinate with users:

      • Schedule updates during low-usage periods
      • Communicate reference data changes
      • Provide training if values change significantly

    Environment-Specific Considerations

    Development environments:

    • Use AddToExistingData freely for testing
    • Update frequently from master data
    • May include test-specific reference values

    Test/UAT environments:

    • Keep synchronized with master data
    • Update less frequently than dev
    • Match production reference data closely

    Production environments:

    • Change control required for updates
    • Schedule during maintenance windows
    • Full backup before updates
    • Use UpdateExisting only when necessary

    Disaster Recovery

    Include organizationsetup in DR plan:

    1. Document master data environment:

      • URL and access credentials
      • Last update date
      • Known customisations
    2. Store organizationsetup command:

      • Save complete command with parameters
      • Document DataSet option used
      • Note any special flags (AddToExistingData, UpdateExisting)
    3. Test recovery process:

      • Periodically restore to test environment
      • Verify all reference data restored correctly
      • Update DR documentation with lessons learned
    4. Recovery sequence:

      • Restore Dataverse environment from backup
      • Run organizationsetup to restore reference data
      • Activate assessment tools
      • Verify critical GUIDs (team templates, Intake Team)
      • Resume normal operations

    See Also

    • organizationsetup - Overview
    • organizationsetup - OutcomesFramework DataSet
    • organizationsetup - ServiceTransfer DataSets
    • Navigator Platform CLI Introduction
    In This Article
    Back to top Copyright © Whānau Tahi Ltd 2025 Leave us feedback on our documentation!