### Install dependencies and start Azure Function locally Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/samples/AzureFunction/README.md Run these commands to install dependencies (downloads Rnwood.Dataverse.Data.PowerShell from PowerShell Gallery) and start the function host. The timer trigger runs every 15 minutes. ```bash # Install dependencies (downloads Rnwood.Dataverse.Data.PowerShell from PowerShell Gallery) func extensions install # Start the function host func start ``` -------------------------------- ### Installation: Set execution policy and install module Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/README.md One-time setup to allow local scripts and install the Rnwood.Dataverse.Data.PowerShell module for the current user. Requires PowerShell execution policy change to RemoteSigned. ```powershell # Set execution policy (one-time setup) Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope CurrentUser # Install module Install-Module Rnwood.Dataverse.Data.PowerShell -Scope CurrentUser ``` -------------------------------- ### Get all app modules Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseAppModule.md Connects to Dataverse and retrieves all app modules in the environment. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseAppModule ``` -------------------------------- ### Install Specific Module Version Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/installation.md Installs a specific version of the module. Pinning the version you have tested is recommended for important scripts. ```powershell Install-Module Rnwood.Dataverse.Data.PowerShell -RequiredVersion 100.0.0 -Scope CurrentUser ``` -------------------------------- ### Install Adapter Packages Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/migration-from-fakexrmeasy.md Commands to install optional adapter packages for Moq, FakeItEasy, AwesomeAssertions, and Shouldly. ```bash // Moq adapter dotnet add package Fake4Dataverse.Moq // FakeItEasy adapter dotnet add package Fake4Dataverse.FakeItEasy // AwesomeAssertions adapter dotnet add package Fake4Dataverse.AwesomeAssertions // Shouldly adapter dotnet add package Fake4Dataverse.Shouldly ``` -------------------------------- ### Environment Setup Commands Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/AGENTS.md Commands to load a .env file and connect to a dev environment using Get-DataverseConnection. ```powershell # Load .env file if (Test-Path .env) { Get-Content .env | ForEach-Object { if ($_ -match '^\s*([^#][^=]+?)\s*=\s*(.+)\s*$') { [Environment]::SetEnvironmentVariable($matches[1], $matches[2]) } } } # Connect to dev environment $conn = Get-DataverseConnection ` -Url $env:DATAVERSE_DEV_URL ` -ClientId $env:DATAVERSE_DEV_CLIENTID ` -ClientSecret $env:DATAVERSE_DEV_CLIENTSECRET ``` -------------------------------- ### Install Module from PowerShell Gallery Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/installation.md Installs the module for the current user. Add -AllowPrerelease to install the bleeding edge development build. ```powershell Install-Module Rnwood.Dataverse.Data.PowerShell -Scope CurrentUser ``` -------------------------------- ### Example 1: Get all plugin assemblies Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataversePluginAssembly.md Connects to a Dataverse environment interactively and sets it as default, then retrieves all plugin assemblies in that environment. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataversePluginAssembly -All ``` -------------------------------- ### Get All Users in a Team Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Retrieves all users in a team using FetchXML or SQL queries. ```APIDOC ## Get-DataverseRecord (FetchXML) ### Description Retrieves records from Dataverse using a FetchXML query. ### Method Cmdlet ### Parameters - **Connection** (object) - Required - The Dataverse connection object. - **FetchXml** (string) - Required - The FetchXML query string. ### Example ```powershell $fetchXml = @" "@ $members = Get-DataverseRecord -Connection $conn -FetchXml $fetchXml ``` ## Invoke-DataverseSql (SELECT) ### Description Retrieves users in a team using a SQL query. ### Method Cmdlet ### Parameters - **Connection** (object) - Required - The Dataverse connection object. - **Sql** (string) - Required - The SQL SELECT statement. ### Example ```powershell $members = Invoke-DataverseSql -Connection $conn -Sql @" SELECT u.fullname, u.internalemailaddress FROM systemuser u INNER JOIN teammembership tm ON u.systemuserid = tm.systemuserid WHERE tm.teamid = '$teamId' "@ ``` ``` -------------------------------- ### Work with default connection Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEntityMetadata.md Demonstrates using the default connection for simplified commands. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> # Set a default connection PS C:\> $conn = Get-DataverseConnection -Url "https://myorg.crm.dynamics.com" -Interactive PS C:\> Set-DataverseConnectionAsDefault PS C:\> # Now get metadata without specifying connection PS C:\> $metadata = Get-DataverseEntityMetadata -EntityName account PS C:\> $metadata.LogicalName account ``` -------------------------------- ### Launch FetchXML Builder with current connection Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Invoke-DataverseXrmToolbox.md Connects to Dataverse interactively and launches the FetchXML Builder plugin with the connection automatically injected. ```powershell # Connect to Dataverse $conn = Get-DataverseConnection -Interactive -Url "https://yourorg.crm.dynamics.com" # Launch FetchXML Builder plugin Invoke-DataverseXrmToolbox -PackageName "Cinteros.Xrm.FetchXMLBuilder" ``` -------------------------------- ### Example 2: Get plugin assembly by ID Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataversePluginAssembly.md Connects to a Dataverse environment and retrieves a specific plugin assembly using its GUID ID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataversePluginAssembly -Id 12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Preview changes without applying with -WhatIf Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseAppmoduleIconFromSet.md Shows what changes would be made without actually applying them. ```powershell Set-DataverseAppmoduleIconFromSet -UniqueName "my_app" -IconName "user" -PublisherPrefix "contoso" -WhatIf ``` -------------------------------- ### Get sections from a specific tab Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseFormSection.md Retrieves all sections from the 'General' tab of a form identified by a GUID. Requires an active connection and a valid form ID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $formId = '12345678-1234-1234-1234-123456789012' PS C:\> Get-DataverseFormSection -FormId $formId -TabName 'General' ``` -------------------------------- ### Build complex entity with EntityBuilder Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Use the fluent EntityBuilder to keep setup readable for complex entities. Builds an account entity with a name and state. ```csharp var account = new EntityBuilder("account") .WithName("Contoso") .WithState(0) .Build(); ``` -------------------------------- ### Deploy solution and set connection references Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/environment-variables-connection-references.md Imports a solution that includes connection references, then sets the references to environment-specific connections using the multiple parameter set. The references must already exist in the target environment. ```powershell # Import solution (connection references included) Import-DataverseSolution -InFile "MySolution.zip" # Set connection references to environment-specific connections Set-DataverseConnectionReference -ConnectionReferences @{ 'new_sharepoint' = '12345678-1234-1234-1234-123456789012' 'new_sql' = '87654321-4321-4321-4321-210987654321' 'new_customapi' = '11111111-2222-3333-4444-555555555555' } ``` -------------------------------- ### Get Canvas apps by name pattern with Get-DataverseCanvasApp -Name Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseCanvasApp.md Retrieves all Canvas apps whose name starts with "MyApp". The -Name parameter supports wildcards (* and ?). ```powershell PS C:\> Get-DataverseCanvasApp -Name "MyApp*" ``` -------------------------------- ### Get a connection by selecting from available environments Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/quickstart.md Use Get-DataverseConnection with -interactive to interactively select from available environments. The returned connection object is used with -Connection. ```powershell $c = Get-DataverseConnection -interactive ``` -------------------------------- ### Use WhatIf to preview Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseAppModuleComponent.md Shows what would happen without actually removing the component. Uses -WhatIf to preview the removal operation. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataverseAppModuleComponent -AppModuleUniqueName "myapp" -ObjectId $entityId -WhatIf ``` -------------------------------- ### Get Canvas app by ID with Get-DataverseCanvasApp -Id Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseCanvasApp.md Retrieves a specific Canvas app by its GUID using the default connection. The -Id parameter is required in the Id parameter set. ```powershell PS C:\> Get-DataverseCanvasApp -Id "12345678-1234-1234-1234-123456789012" ``` -------------------------------- ### Example 3: Get environment variables by display name Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEnvironmentVariableDefinition.md Connects to Dataverse and retrieves all environment variable definitions where the display name starts with "API" using the -DisplayName parameter with wildcard support. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseEnvironmentVariableDefinition -DisplayName "API*" ``` -------------------------------- ### Create FakeDataverseEnvironment with Presets Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Shows how to instantiate FakeDataverseEnvironment with default, Strict, and Lenient options. Strict enables metadata and security checks, while Lenient disables all auto-behaviors. ```csharp var env = new FakeDataverseEnvironment(); // Default var strict = new FakeDataverseEnvironment(FakeOrganizationServiceOptions.Strict); // Metadata + security on var lenient = new FakeDataverseEnvironment(FakeOrganizationServiceOptions.Lenient); // All auto-behaviors off var service = env.CreateOrganizationService(); var strictService = strict.CreateOrganizationService(); var lenientService = lenient.CreateOrganizationService(); ``` -------------------------------- ### Test upload with WhatIf and verify Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/web-resources.md Uses -WhatIf to preview upload without applying, then verifies by retrieving the resource and checking its display name. ```powershell # Test upload with WhatIf Set-DataverseWebResource -Connection $conn -Folder "./webresources" -PublisherPrefix "contoso" -WhatIf ``` ```powershell # Verify upload $uploaded = Get-DataverseWebResource -Connection $conn -Name "contoso_script" if ($uploaded) { Write-Host "Upload successful: $($uploaded.displayname)" } ``` -------------------------------- ### Get-DataversePluginPackage Example - Retrieve All Packages Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataversePluginPackage.md Connects to a Dataverse environment interactively and sets it as default, then retrieves all plugin packages using the -All parameter. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataversePluginPackage -All ``` -------------------------------- ### Get a connection to MYORG using interactive authentication Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/quickstart.md Use Get-DataverseConnection with the -interactive flag to authenticate interactively for a specific environment URL. The returned connection object (e.g., $c) is passed to other cmdlets via -Connection. ```powershell $c = Get-DataverseConnection -url https://myorg.crm11.dynamics.com -interactive ``` -------------------------------- ### Get solutions using wildcard patterns with Get-DataverseSolution -UniqueName Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseSolution.md Connects to a Dataverse environment and retrieves all solutions whose unique name starts with 'Contoso' using a wildcard pattern. The output shows the UniqueName, Name, Version, and IsManaged for each matching solution. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseSolution -UniqueName "Contoso*" UniqueName Name Version IsManaged ---------- ---- ------- --------- ContosoSales Contoso Sales 1.0.0.0 False ContosoMarketing Contoso Marketing 2.1.0.0 False ``` -------------------------------- ### List all components from a solution file Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseSolutionFileComponent.md Connects to Dataverse and retrieves all root components from the specified solution file, including environment variables and connection references. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $conn = Get-DataverseConnection -Url "https://contoso.crm.dynamics.com" -Interactive PS C:\> Get-DataverseSolutionFileComponent -SolutionFile "C:\Solutions\MySolution_1_0_0_0.zip" ``` -------------------------------- ### Load FakeOrganizationServiceOptions from JSON or Environment Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Shows two ways to load options: from a JSON file using FromJsonFile, or from environment variables with prefix FAKE4DATAVERSE_ using FromEnvironment. ```csharp var options = FakeOrganizationServiceOptions.FromJsonFile("test-config.json"); var options = FakeOrganizationServiceOptions.FromEnvironment(); // prefix: FAKE4DATAVERSE_ ``` -------------------------------- ### Snapshot and restore with env.TakeSnapshot() and env.RestoreSnapshot() Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Manually create a save-point with TakeSnapshot() and revert to it later with RestoreSnapshot(). Provides more control than scoped rollback for complex test scenarios. ```csharp env.TakeSnapshot(); // ... make changes ... env.RestoreSnapshot(); // reverts to snapshot ``` -------------------------------- ### Preview removal with WhatIf parameter Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseAppModule.md Shows what would happen when removing an app module without actually performing the removal. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataverseAppModule -UniqueName "myapp" -WhatIf ``` -------------------------------- ### Primary ID Attribute Set on Create Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md After service.Create(entity) returns, the primary ID attribute on the passed-in Entity object is automatically set to the new GUID. This mirrors real Dataverse behaviour and is useful when plugin code accesses entity.Id after calling Create. ```csharp var entity = new Entity("account") { ["name"] = "Contoso" }; var id = service.Create(entity); // entity["accountid"] is now equal to id Assert.Equal(id, entity.GetAttributeValue("accountid")); ``` -------------------------------- ### Development workflow: backup, edit, upload, publish Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/web-resources.md Four-step workflow: download current resources for backup, edit locally, upload changed files with -IfNewer, then publish all customizations for production. ```powershell # 1. Download current web resources for backup Get-DataverseWebResource -Connection $conn -Name "contoso_*" -Folder "./backup" ``` ```powershell # 2. Make changes to local files # ... edit files ... ``` ```powershell # 3. Upload changed files only Set-DataverseWebResource -Connection $conn -Folder "./src" -IfNewer -PublisherPrefix "contoso" ``` ```powershell # 4. Publish all at once (for production) Publish-DataverseCustomizations -Connection $conn ``` -------------------------------- ### Remove-DataversePluginType example Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataversePluginType.md Connects to a Dataverse environment and removes a plugin type by its ID. The example uses a placeholder GUID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataversePluginType -Id 12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Deploy a solution with environment variables Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/environment-variables-connection-references.md Import a solution that includes environment variable definitions, then set environment-specific values for the imported definitions. ```powershell # Import solution (definitions included) Import-DataverseSolution -InFile "MySolution.zip" # Set environment-specific values Set-DataverseEnvironmentVariableValue -EnvironmentVariableValues @{ 'new_apiurl' = 'https://api.production.example.com' 'new_dbconnection' = 'Server=prod-sql;Database=ProdDB' 'new_batchsize' = '100' } ``` -------------------------------- ### Get app module with raw values Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseAppModule.md Connects to Dataverse and retrieves an app module with all raw attribute values instead of parsed properties using the -Raw parameter. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseAppModule -Id $appId -Raw ``` -------------------------------- ### Build Commands (dotnet clean and dotnet build) Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/CONTRIBUTING.md Run these commands to clean and build the solution. Requires .NET SDK 8.0+. ```bash # Clean dotnet clean # Build dotnet build ``` -------------------------------- ### Get operation details with -PassThru Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/solution-component-management.md Use -PassThru to get detailed information about the operation. The example stores the result and writes the SolutionComponentId, Behavior, and WasUpdated properties. ```powershell $result = Set-DataverseSolutionComponent -Connection $c -SolutionName "MySolution" ` -ComponentId $entityId -ComponentType 1 -Behavior 0 -PassThru Write-Host "Solution Component ID: $($result.SolutionComponentId)" Write-Host "Behavior: $($result.Behavior)" Write-Host "Was Updated: $($result.WasUpdated)" ``` -------------------------------- ### Example 1: Parse a solution file from disk Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseSolutionFile.md Connects to Dataverse and parses a solution file from a local path, displaying metadata such as UniqueName, Name, Version, IsManaged, Description, and publisher information. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseSolutionFile -Path "C:\Solutions\MySolution_1_0_0_0.zip" UniqueName : MySolution Name : My Solution Version : 1.0.0.0 IsManaged : False Description : My custom solution for business processes PublisherName : Contoso PublisherUniqueName : contoso PublisherPrefix : con ``` -------------------------------- ### Remove-DataversePluginStepImage example Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataversePluginStepImage.md Connects to a Dataverse environment and removes a plugin step image by its ID. The -Id parameter is required; the example uses a placeholder GUID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataversePluginStepImage -Id 12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Example 2: Get a specific entity key Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEntityKeyMetadata.md Retrieves metadata for a specific entity key by name. The example fetches the emailaddress1_key key from the contact table. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseEntityKeyMetadata -EntityName contact -KeyName emailaddress1_key ``` -------------------------------- ### Create and verify navigation type & featured flag Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseAppModule.md Connects to Dataverse, creates an app module with multi-session navigation and featured flag, then verifies the values using Select-Object. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $id = Set-DataverseAppModule -PassThru -UniqueName "multi_session_app" -Name "Multi Session" -NavigationType MultiSession -IsFeatured $true PS C:\> Get-DataverseAppModule -Id $id | Select-Object UniqueName, NavigationType, IsFeatured ``` -------------------------------- ### Get all sections from a form Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseFormSection.md Connects to Dataverse, retrieves the contact Information form, and gets all sections from all tabs. Requires an active connection and a form ID from Get-DataverseForm. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $form = Get-DataverseForm -Entity 'contact' -Name 'Information' PS C:\> Get-DataverseFormSection -FormId $form.FormId ``` -------------------------------- ### Preview changes without applying with -WhatIf Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseTableIconFromSet.md Shows what changes would be made without actually applying them. ```powershell Set-DataverseTableIconFromSet -EntityName "contact" -IconName "user" -PublisherPrefix "contoso" -WhatIf ``` -------------------------------- ### RegisterDefaultStatusCode Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Overrides the statecode/statuscode that are set automatically on Create when AutoSetStateCode = true. ```APIDOC ## RegisterDefaultStatusCode ### Description Overrides the statecode/statuscode that are set automatically on Create when AutoSetStateCode = true. ### Method RegisterDefaultStatusCode ### Parameters - **entityLogicalName** (string) - Required - The logical name of the entity. - **stateCode** (int) - Required - The state code to set. - **statusCode** (int) - Required - The status code to set. ### Example ```csharp // Make new "incident" records start as "In Progress" (statecode=0, statuscode=2) // instead of the generic default (statecode=0, statuscode=1) env.RegisterDefaultStatusCode("incident", stateCode: 0, statusCode: 2); ``` ``` -------------------------------- ### Set Execution Policy to RemoteSigned Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/installation.md Required before installing the module because it is not signed. Sets the execution policy for the current user to allow loading unsigned scripts from remote sources. ```powershell Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope CurrentUser ``` -------------------------------- ### Export and import solution with web resources Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/core-concepts/web-resources.md Exports a solution to a zip file and imports it back, including web resources. Requires solution name and path. ```powershell # Export solution with web resources Export-DataverseSolution -Connection $conn -SolutionName "MySolution" -Path "./solution.zip" ``` ```powershell # Import solution (includes web resources) Import-DataverseSolution -Connection $conn -Path "./solution.zip" ``` -------------------------------- ### Retrieve all solutions with Get-DataverseSolution Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseSolution.md Connects to a Dataverse environment and retrieves all solutions. The output shows the UniqueName, Name, Version, IsManaged, and PublisherName for each solution. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseSolution UniqueName Name Version IsManaged PublisherName ---------- ---- ------- --------- ------------- MySolution My Solution 1.0.0.0 False Contoso Active Active Solution 1.0.0.0 True Microsoft Default Default Solution 1.0.0.0 True Microsoft ``` -------------------------------- ### Install Fake4Dataverse.Tool global tool Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/README.md Install the Fake4Dataverse.Tool dotnet global tool to export real table metadata from a Dataverse environment to XML files. ```bash dotnet tool install --global Fake4Dataverse.Tool ``` -------------------------------- ### Example 15: Get IDs of created records using PassThru Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseRecord.md Creates multiple contact records and returns the input objects with their Id property set. The -PassThru parameter causes the cmdlet to write each input object to the pipeline after the record is created, with the Id property populated with the GUID of the newly created record. This allows you to capture and use the IDs in subsequent operations. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $contacts = @( @{ firstname = "Alice"; lastname = "Anderson" } @{ firstname = "Bob"; lastname = "Brown" } @{ firstname = "Charlie"; lastname = "Clark" } ) PS C:\> $createdRecords = $contacts | Set-DataverseRecord -TableName contact -CreateOnly -PassThru PS C:\> # Access the IDs of created records PS C:\> foreach ($record in $createdRecords) { Write-Host "Created contact $($record.firstname) $($record.lastname) with ID: $($record.Id)" } ``` -------------------------------- ### Import a Solution with Rnwood.Dataverse.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Reads a solution file and imports it using Invoke-DataverseImportSolution with options for publishing workflows and overwriting unmanaged customizations. Requires a connection object $conn. ```powershell $solutionBytes = [System.IO.File]::ReadAllBytes("C:\Solutions\MySolution.zip") # Using specialized cmdlet (simplest) Invoke-DataverseImportSolution -Connection $conn ` -CustomizationFile $solutionBytes ` -PublishWorkflows $true ` -OverwriteUnmanagedCustomizations $false ``` -------------------------------- ### requirements.psd1 for automatic module installation Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/samples/AzureFunction/README.md This requirements.psd1 file installs the Rnwood.Dataverse.Data.PowerShell module automatically. Azure Functions downloads and caches the module on first run when using this approach. ```powershell @{ 'Rnwood.Dataverse.Data.PowerShell' = '2.*' } ``` -------------------------------- ### Get All Business Process Flow Stages - Rnwood.Dataverse.Data.PowerShell (Invoke-DataverseSql) Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Uses SQL for better querying, joining processstage with workflow to get process names. Requires an existing connection object $conn. ```powershell # Or using SQL for better querying $stages = Invoke-DataverseSql -Connection $conn -Sql @" SELECT ps.primaryentitytypecode, w.name as processname, ps.processid, ps.processstageid, ps.stagecategory, ps.stagename FROM processstage ps INNER JOIN workflow w ON ps.processid = w.workflowid ORDER BY ps.primaryentitytypecode, ps.stagename "@ $stages | Format-Table ``` -------------------------------- ### List All Solutions with Microsoft.Xrm.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Retrieves solution records and selects the unique name, friendly name, and version. Requires a connection object $conn. ```powershell $solutions = Get-CrmRecords -EntityLogicalName solution -Fields uniquename,friendlyname,version $solutions.CrmRecords | Select-Object uniquename,friendlyname,version ``` -------------------------------- ### Standard Build Commands Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/AGENTS.md Commands to clean and build the solution. The build takes approximately 30-60 seconds from clean. ```powershell # Clean build dotnet clean # Build entire solution (Debug configuration) dotnet build # Build specific configuration dotnet build -c Release # Build takes approximately 30-60 seconds from clean ``` -------------------------------- ### BaseCurrencyId Property Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/currency-exchange-rates.md Gets or sets the GUID of the organization's base currency record. ```APIDOC ## BaseCurrencyId Property ### Description Gets or sets the GUID of the organization's base currency record. ### Method Property ### Parameters - **value** (Guid) - Required - The GUID of the base currency record. ### Example ```csharp env.Currency.BaseCurrencyId = usdId; ``` ``` -------------------------------- ### Using the Metadata Cache with Get Cmdlets Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/Metadata-CRUD-Examples.md Use the -UseMetadataCache parameter on Get cmdlets to utilize the shared cache. The cache is automatically populated when you use the parameter; no setup or enabling is required. ```powershell # Use cache for entity metadata retrieval $metadata = Get-DataverseEntityMetadata -Connection $conn -EntityName contact -UseMetadataCache # Use cache for listing entities $entities = Get-DataverseEntityMetadata -Connection $conn -UseMetadataCache # Use cache for attribute metadata $attributes = Get-DataverseAttributeMetadata -Connection $conn -EntityName contact -UseMetadataCache ``` -------------------------------- ### Compare entity metadata between environments Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEntityMetadata.md Compares entities between development and production environments by retrieving logical names and finding differences. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $dev = Get-DataverseConnection -Url "https://dev.crm.dynamics.com" -Interactive PS C:\> $prod = Get-DataverseConnection -Url "https://prod.crm.dynamics.com" -Interactive PS C:\> $devEntities = Get-DataverseEntityMetadata | Select-Object -ExpandProperty LogicalName PS C:\> $prodEntities = Get-DataverseEntityMetadata | Select-Object -ExpandProperty LogicalName PS C:\> $onlyInDev = $devEntities | Where-Object { $_ -notin $prodEntities } PS C:\> $onlyInProd = $prodEntities | Where-Object { $_ -notin $devEntities } PS C:\> Write-Host "Entities only in Dev: $($onlyInDev -join ', ')" PS C:\> Write-Host "Entities only in Prod: $($onlyInProd -join ', ')" ``` -------------------------------- ### RegisterDefaultStatusCode for incident entity Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md Overrides the statecode/statuscode set automatically on Create when AutoSetStateCode is true. New incident records start as 'In Progress' (statecode=0, statuscode=2) instead of the generic default (statecode=0, statuscode=1). ```csharp // Make new "incident" records start as "In Progress" (statecode=0, statuscode=2) // instead of the generic default (statecode=0, statuscode=1) env.RegisterDefaultStatusCode("incident", stateCode: 0, statusCode: 2); ``` -------------------------------- ### List All Solutions with Rnwood.Dataverse.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Lists solutions using either Get-DataverseRecord or a SQL query via Invoke-DataverseSql. The SQL query filters for unmanaged solutions only. Requires a connection object $conn. ```powershell # Using Get-DataverseRecord $solutions = Get-DataverseRecord -Connection $conn -TableName solution -Columns uniquename,friendlyname,version $solutions | Select-Object uniquename,friendlyname,version # Or using SQL Invoke-DataverseSql -Connection $conn -Sql @" SELECT uniquename, friendlyname, version FROM solution WHERE ismanaged = 0 ORDER BY friendlyname "@ ``` -------------------------------- ### Pipeline entity name to get metadata Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEntityMetadata.md Pipelines multiple entity names to retrieve their metadata. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> @("account", "contact", "lead") | Get-DataverseEntityMetadata | Select-Object LogicalName, DisplayName, PrimaryNameAttribute LogicalName DisplayName PrimaryNameAttribute ----------- ----------- -------------------- account Account name contact Contact fullname lead Lead fullname ``` -------------------------------- ### Example 6: Create and publish a sitemap Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseSitemap.md Creates a new sitemap with a sales-oriented navigation structure and immediately publishes it using the -Publish parameter so it becomes available in model-driven apps. The output shows the created and published sitemap ID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $sitemapXml = @" "@ PS C:\> Set-DataverseSitemap -Name "SalesSitemap" -SitemapXml $sitemapXml -Publish Sitemap 'SalesSitemap' created successfully with ID: d4e5f6g7-8901-23de-f456-789012d3ef45 Published sitemap with ID: d4e5f6g7-8901-23de-f456-789012d3ef45 ``` -------------------------------- ### Get entities with change tracking enabled Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEntityMetadata.md Finds entities with change tracking enabled for data synchronization. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseEntityMetadata | Where-Object { $_.ChangeTrackingEnabled -eq $true } | Select-Object LogicalName, DisplayName LogicalName DisplayName ----------- ----------- account Account contact Contact ``` -------------------------------- ### Create a New Sitemap - Rnwood.Dataverse.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Shows two ways to create a sitemap: using the specialized Set-DataverseSitemap with -PassThru, or the generic Set-DataverseRecord with a fields hashtable. ```powershell $sitemapXml = @" "@ # Using specialized cmdlet (simplest) $sitemapId = Set-DataverseSitemap -Connection $conn -Name "MySitemap" -SitemapXml $sitemapXml -PassThru # Or using generic cmdlet $sitemapId = Set-DataverseRecord -Connection $conn -TableName sitemap -Fields @{ sitemapname = "MySitemap" sitemapxml = $sitemapXml } ``` -------------------------------- ### Launch a specific version of Metadata Browser Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Invoke-DataverseXrmToolbox.md Launches a specific version of the Metadata Browser plugin using the -Version parameter. ```powershell # Launch a specific version of the Metadata Browser Invoke-DataverseXrmToolbox -PackageName "MsCrmTools.MetadataBrowser" -Version "1.2024.5.12" ``` -------------------------------- ### Get All Views for an Entity - Microsoft.Xrm.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Retrieves all savedquery records for the 'account' entity using Get-CrmRecords with a filter on returnedtypecode. ```powershell $views = Get-CrmRecords -EntityLogicalName savedquery ` -FilterAttribute returnedtypecode -FilterOperator eq -FilterValue "account" ` -Fields name,querytype,isdefault ``` -------------------------------- ### Get All Users in a Team - Microsoft.Xrm.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Retrieves all users in a team using Get-CrmRecords with FetchXML. Requires $teamId variable. ```powershell $teamId = "guid-here" $members = Get-CrmRecords -EntityLogicalName systemuser -FetchXml @" "@ ``` -------------------------------- ### Using WhatIf to preview changes Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseFormLibrary.md Connects to Dataverse and previews the library addition without making changes. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Set-DataverseFormLibrary -FormId $formId -LibraryName "new_/scripts/mycode.js" -WhatIf ``` -------------------------------- ### Seed from inline JSON or CSV strings Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/getting-started.md SeedFromJson and SeedFromCsv accept inline strings for seeding data. ```csharp env.SeedFromJson(jsonString); env.SeedFromCsv(csvString); ``` -------------------------------- ### Example 3: Load sitemap XML from file and create sitemap Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseSitemap.md Loads sitemap XML from a file using Get-Content and creates a new sitemap with that XML. The output shows the created sitemap ID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $sitemapXml = Get-Content -Path "MySitemap.xml" -Raw PS C:\> Set-DataverseSitemap -Name "ImportedSitemap" -SitemapXml $sitemapXml Sitemap 'ImportedSitemap' created successfully with ID: b2c3d4e5-6789-01bc-def2-345678901bcd ``` -------------------------------- ### Upload Multiple Web Resources from Folder - Microsoft.Xrm.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Loops through .js files in a folder, creates a web resource entity for each, and creates them. Requires manual file reading, base64 encoding, and entity construction. ```powershell # Complex - requires looping and manual handling $files = Get-ChildItem -Path "C:\webresources" -File -Filter "*.js" foreach ($file in $files) { $fileContent = [System.IO.File]::ReadAllBytes($file.FullName) $base64 = [System.Convert]::ToBase64String($fileContent) $webResource = New-Object Microsoft.Xrm.Sdk.Entity("webresource") $webResource.Attributes["name"] = "new_/$($file.Name)" $webResource.Attributes["displayname"] = $file.BaseName $webResource.Attributes["webresourcetype"] = New-Object Microsoft.Xrm.Sdk.OptionSetValue(3) $webResource.Attributes["content"] = $base64 $conn.Create($webResource) } ``` -------------------------------- ### Remove-DataversePluginPackage example Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataversePluginPackage.md Connects to a Dataverse environment and removes a plugin package by its ID. The -Id parameter is required and accepts a GUID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataversePluginPackage -Id 12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Remove-DataversePluginStep example Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataversePluginStep.md Connects to a Dataverse environment and removes a plugin step by its ID. The -Id parameter is required and accepts a GUID. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataversePluginStep -Id 12345678-1234-1234-1234-123456789012 ``` -------------------------------- ### Upload Multiple Web Resources from Folder - Rnwood.Dataverse.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Processes an entire folder with a single Set-DataverseWebResource command, using -Folder, -PublisherPrefix, -FileFilter, and -Publish. ```powershell # Simple - single command processes entire folder Set-DataverseWebResource -Connection $conn -Folder "C:\webresources" ` -PublisherPrefix "new" -FileFilter "*.js" -Publish ``` -------------------------------- ### CurrencyManager.GetExchangeRate(Guid currencyId) Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/reference/api-reference.md Gets the exchange rate for a specified currency. Returns the rate as a decimal. ```APIDOC ## CurrencyManager.GetExchangeRate(Guid currencyId) ### Description Gets the exchange rate for a specified currency. ### Method GetExchangeRate ### Parameters #### Parameters - **currencyId** (Guid) - Required - The ID of the currency. ### Returns - **decimal** - The exchange rate. ``` -------------------------------- ### Find app modules by name with wildcards Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseAppModule.md Connects to Dataverse and finds all app modules whose names start with "Sales" using wildcard pattern matching. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseAppModule -Name "Sales*" ``` -------------------------------- ### Example 1: List all data sources Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseMsAppDataSource.md Lists all data sources from the specified .msapp file. ```powershell Get-DataverseMsAppDataSource -MsAppPath "myapp.msapp" ``` -------------------------------- ### Example 3: Get plugin assembly by name Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataversePluginAssembly.md Connects to a Dataverse environment and retrieves a plugin assembly by its name. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataversePluginAssembly -Name "MyPluginAssembly" ``` -------------------------------- ### Mock with AsMock() Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Fake4Dataverse/docs/guides/assertion-adapters.md Creates a mock IOrganizationService from the fake environment. Use mock.Object in production code and Moq's Verify() to assert calls like Create and Delete. ```csharp using Fake4Dataverse.Moq; using Moq; var env = new FakeDataverseEnvironment(); var service = env.CreateOrganizationService(); Mock mock = service.AsMock(); // Pass mock.Object to production code that expects IOrganizationService mock.Object.Create(new Entity("account") { ["name"] = "Contoso" }); // Assert with Moq mock.Verify(m => m.Create(It.IsAny()), Times.Once); mock.Verify(m => m.Delete(It.IsAny(), It.IsAny()), Times.Never); ``` -------------------------------- ### Example 1: Get all environment variable definitions Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseEnvironmentVariableDefinition.md Connects to Dataverse and retrieves all environment variable definitions in the environment. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseEnvironmentVariableDefinition ``` -------------------------------- ### Download Web Resource - Rnwood.Dataverse.Data.PowerShell Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Examples-Comparison.md Downloads a web resource by name using Get-DataverseWebResource, automatically handling base64 decoding and file writing. ```powershell # Simple - automatically handles base64 decoding and file writing Get-DataverseWebResource -Connection $conn -Name "new_script" -Path "C:\downloaded-script.js" ``` -------------------------------- ### Update Module Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/docs/getting-started/installation.md Updates the module to the latest version. Add -AllowPrerelease to update to the bleeding edge development build. ```powershell Update-Module Rnwood.Dataverse.Data.PowerShell -Force ``` -------------------------------- ### Get relationships with cascade delete (Example 7) Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseRelationshipMetadata.md Finds OneToMany relationships where the CascadeDelete behavior is set to Cascade, meaning related records are deleted when the parent is deleted. The output shows examples for account, contact, and lead entities. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> $cascadeDeleteRels = Get-DataverseRelationshipMetadata -RelationshipType OneToMany | Where-Object { $_.CascadeDelete.Value -eq "Cascade" } PS C:\> $cascadeDeleteRels | Select-Object SchemaName, ReferencedEntity, ReferencingEntity, CascadeDelete SchemaName ReferencedEntity ReferencingEntity CascadeDelete ---------- ----------------- ----------------- ------------- account_Account_Email_Email account email Cascade contact_Contact_Email_Email contact email Cascade lead_Lead_Email_Email lead email Cascade ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/AGENTS.md Examples of valid PR titles following the Conventional Commits format. Use these to trigger automatic version bumps: feat for minor, fix for patch, and feat! or fix! for major releases. ```text feat: add batch delete operation fix: resolve connection timeout issue feat!: remove deprecated parameters fix(auth): handle expired tokens correctly docs: update installation instructions ``` -------------------------------- ### Use WhatIf to preview deletion Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseView.md Shows what would happen if the view were deleted without actually deleting it, using -WhatIf. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Remove-DataverseView -Id $viewId -ViewType "System" -WhatIf ``` -------------------------------- ### Get app module by UniqueName Source: https://github.com/alm4dataverse/rnwood.dataverse.data.powershell/blob/main/Rnwood.Dataverse.Data.PowerShell/docs/Get-DataverseAppModule.md Connects to Dataverse and retrieves the Sales Hub app module using its unique name. ```powershell PS C:\> Get-DataverseConnection -Url https://myorg.crm.dynamics.com -Interactive -SetAsDefault PS C:\> Get-DataverseAppModule -UniqueName "msdyn_SalesHub" ```