Transfer configuration data between environments. Code adapted from ConfigDataMover.
Runs a given fetchXml query to retrieve data from CRM and store it as json
at a given directory.
Reads data as json
from a given directory and imports it into CRM.
Establish which duplicate detection rules are published before a deployment, and then republish them after a deployment.
Gets all published duplicate detection rules in CRM and stores them as a json
file.
Reads a json
file to determine which duplicate detection rules should be republished and republishes them.
Deactivates all forms in CRM matching any of the ids given as a comma separated string.
Conditionally sets an SLA as being active and/or default. Can also retrieve business hours (calendar) and assign it to the SLA.
Assigns all workflows in CRM to a given user.
- Compile code in release mode.
- Create an empty release task. See Microsoft HowTo.
How you execute the VstsExtensions.dll is your choice. This example uses PowerShell to deploy the task "Export to file":
- In your tasks folder, add
ExportToFile.ps1
:
[CmdletBinding(DefaultParameterSetName = 'None')]
param (
[String] [Parameter(Mandatory = $true)]
$Connection,
[String] [Parameter(Mandatory = $true)]
$WorkingDirectory,
[String] [Parameter(Mandatory = $true)]
$FetchXml
)
$ScriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$ExtensionsPath = $ScriptPath + "\VstsExtensions.dll"
$ExtensionsCorePath = $ScriptPath + "\VstsExtensions.Core.dll"
Write-Verbose "Entering ExportToFile.ps1"
Write-Verbose "Connection is $Connection"
Write-Verbose "Working direcory is $WorkingDirectory"
Get-ChildItem path -recurse
Add-Type -Path $ExtensionsPath
Add-Type -Path $ExtensionsCorePath
$ExportToFile = New-Object -TypeName VstsExtensions.ExportToFile -ArgumentList $Connection, $WorkingDirectory, $FetchXml
$ExportToFile.Run()
Write-Verbose "Leaving ExportToFile.ps1"
- In your
task.json
, specify input parameters:
"inputs": [
{
"name": "Connection",
"type": "string",
"label": "Connection",
"defaultValue": "",
"required": true,
"helpMarkDown": "CRM connection string"
},
{
"name": "WorkingDirectory",
"type": "string",
"label": "Working Directory",
"defaultValue": "",
"required": true,
"helpMarkDown": "Default working directory. Must match the directory used to read from when importing data to CRM."
},
{
"name": "FetchXml",
"type": "string",
"label": "FetchXml",
"defaultValue": "",
"required": true,
"helpMarkDown": "Query used to read data from CRM."
}
]
Also specify your execution:
"execution": {
"PowerShell": {
"target": "$(currentDirectory)\\ExportToFile.ps1",
"workingDirectory": "$(currentDirectory)"
}
}
- Run your script locally to confirm it's working.
- Build your VSTS task with
tfx extension create --manifest-globs vss-extension.json
. It will compile to a .tfix file. - Publish your extension to VSTS. See Microsoft HowTo.