Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10501,6 +10501,61 @@
<SupportInformation ad="false" rsat="false" ps2="false" ps3="false" ps4="false" ps5="false" wxp="false" wv="false" w7="false" w8="false" w81="false" w10="false" w2k3s="false" w2k3e="false" w2k3d="false" w2k8s="false" w2k8e="false" w2k8d="false" w2k8r2s="false" w2k8r2e="false" w2k8r2d="false" w2k12s="false" w2k12d="false" w2k12r2s="false" w2k12r2d="false" />
<Publish>false</Publish>
</CmdletObject>
<CmdletObject verb="New" noun="CrmSolutionPatch">
<Name>New-CrmSolutionPatch</Name>
<Syntax>
<string>New-CrmSolutionPatch [-conn &lt;CrmServiceClient&gt;] [-PatchName] &lt;String&gt; </string>
</Syntax>
<GeneralHelp>
<Synopsis>Creates a new solution patch.</Synopsis>
<Description>Creates a new empty patch by splitting on the period in the patch name to find the parent patch. It finds all versions of the parent patches and increments the highest build number x (1.2.x.0) by 1 and sets 0 as the revision.</Description>
<Notes />
<InputType />
<InputUrl />
<InputTypeDescription />
<ReturnType />
<ReturnUrl />
<ReturnTypeDescription />
</GeneralHelp>
<ParamSets>
<CommandParameterSetInfo2 Name="__AllParameterSets" Params="conn PatchName" />
</ParamSets>
<Parameters>
<ParameterDescription type="CrmServiceClient" varLen="false" required="false" dynamic="false" pipeRemaining="false" pipe="false" pipeProp="false" isPos="false" pos="named" globbing="false">
<Name>conn</Name>
<Attributes>
<string>System.Management.Automation.ParameterAttribute</string>
<string>System.Management.Automation.ArgumentTypeConverterAttribute</string>
</Attributes>
<Aliases />
<Description>
A connection to your CRM organization. Use $conn = Get-CrmConnection &lt;Parameters&gt; to generate it.
</Description>
<DefaultValue />
</ParameterDescription>
<ParameterDescription type="String" varLen="false" required="true" dynamic="false" pipeRemaining="false" pipe="false" pipeProp="false" isPos="true" pos="1" globbing="false">
<Name>PatchName</Name>
<Attributes>
<string>System.Management.Automation.ParameterAttribute</string>
<string>System.Management.Automation.ArgumentTypeConverterAttribute</string>
</Attributes>
<Aliases />
<Description>The display name of the patch to split and return the parent patch name</Description>
<DefaultValue />
</ParameterDescription>
</Parameters>
<Examples>
<Example>
<Name>Example 1</Name>
<Cmd>New-CrmSolutionPatch -PatchName Customizations.123.PatchDescription</Cmd>
<Description>Creates a new solution patch against the Customizations solution</Description>
<Output />
</Example>
</Examples>
<RelatedLinks />
<SupportInformation ad="false" rsat="false" ps2="false" ps3="false" ps4="false" ps5="false" wxp="false" wv="false" w7="false" w8="false" w81="false" w10="false" w2k3s="false" w2k3e="false" w2k3d="false" w2k8s="false" w2k8e="false" w2k8d="false" w2k8r2s="false" w2k8r2e="false" w2k8r2d="false" w2k12s="false" w2k12d="false" w2k12r2s="false" w2k12r2d="false" />
<Publish>false</Publish>
</CmdletObject>
<CmdletObject verb="Import" noun="CrmSolutionAsync">
<Name>Import-CrmSolutionAsync</Name>
<Syntax>
Expand Down
121 changes: 121 additions & 0 deletions Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.Help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19689,6 +19689,127 @@ When omitting parameter names, you do not provide $conn, cmdlets automatically f
</maml:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<!--Generated by PS Cmdlet Help Editor-->
<command:details>
<command:name>New-CrmSolutionPatch</command:name>
<maml:description>
<maml:para>Creates a new solution patch.</maml:para>
</maml:description>
<maml:copyright>
<maml:para />
</maml:copyright>
<command:verb>New</command:verb>
<command:noun>CrmSolutionPatch</command:noun>
<dev:version />
</command:details>
<maml:description>
<maml:para>Creates a new empty patch by splitting on the period in the patch name to find the parent patch. It finds all versions of the parent patches and increments the highest build number x (1.2.x.0) by 1 and sets 0 as the revision.</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>New-CrmSolutionPatch</maml:name>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="0">
<maml:name>conn</maml:name>
<maml:description>
<maml:para>A connection to your CRM organization. Use $conn = Get-CrmConnection &lt;Parameters&gt; to generate it.
</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">CrmServiceClient</command:parameterValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1">
<maml:name>PatchName</maml:name>
<maml:description>
<maml:para>The display name of the patch to split and return the parent patch name</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="true">String</command:parameterValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="0">
<maml:name>conn</maml:name>
<maml:description>
<maml:para>A connection to your CRM organization. Use $conn = Get-CrmConnection &lt;Parameters&gt; to generate it.
</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">CrmServiceClient</command:parameterValue>
<dev:type>
<maml:name>CrmServiceClient</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue></dev:defaultValue>
</command:parameter>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByValue)" position="1">
<maml:name>PatchName</maml:name>
<maml:description>
<maml:para>The display name of the patch to split and return the parent patch name</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="true">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri/>
</dev:type>
<dev:defaultValue></dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<command:inputType>
<dev:type>
<maml:name></maml:name>
<maml:uri></maml:uri>
<maml:description/>
</dev:type>
<maml:description>
<maml:para />
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<command:returnValue>
<dev:type>
<maml:name></maml:name>
<maml:uri></maml:uri>
<maml:description/>
</dev:type>
<maml:description>
<maml:para />
</maml:description>
</command:returnValue>
</command:returnValues>
<command:terminatingErrors></command:terminatingErrors>
<command:nonTerminatingErrors></command:nonTerminatingErrors>
<maml:alertSet>
<maml:title></maml:title>
<maml:alert>
<maml:para />
</maml:alert>
</maml:alertSet>
<command:examples>
<command:example>
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
<maml:introduction>
<maml:paragraph>PS C:\&gt;</maml:paragraph>
</maml:introduction>
<dev:code>New-CrmSolutionPatch -PatchName Customizations.123.PatchDescription</dev:code>
<dev:remarks>
<maml:para>Creates a new solution patch against the Customizations solution.</maml:para>
<maml:para />
<maml:para />
<maml:para></maml:para>
</dev:remarks>
<command:commandLines>
<command:commandLine>
<command:commandText>
<maml:para />
</command:commandText>
</command:commandLine>
</command:commandLines>
</command:example>
</command:examples>
<maml:relatedLinks>
</maml:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<!--Generated by PS Cmdlet Help Editor-->
<command:details>
<command:name>Grant-CrmRecordAccess</command:name>
Expand Down
51 changes: 51 additions & 0 deletions Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,57 @@ function Get-CrmEntityOptionSet{
return $result
}

#NewCrmSolutionPatch
function New-CrmSolutionPatch {
# .ExternalHelp Microsoft.Xrm.Data.PowerShell.Help.xml
[CmdletBinding()]
PARAM (
[parameter(Mandatory=$false)]
[Microsoft.Xrm.Tooling.Connector.CrmServiceClient]$conn,
[Parameter(Mandatory, Position=1)]
[ValidateNotNullOrEmpty()]
[string]$PatchName
)

BEGIN {
$conn = VerifyCrmConnectionParam -conn $conn -pipelineValue ($PSBoundParameters.ContainsKey('conn'))
}

PROCESS {

$parentSolution = $PatchName -split '\.' | Select-Object -First 1
Write-Verbose "Detected parent solution as: $parentSolution"

$solutions = Get-CrmRecords -conn $conn -EntityLogicalName solution -FilterAttribute friendlyname -FilterOperator "like" -FilterValue "$parentSolution%" -Fields solutionid,uniquename,friendlyname,version
Write-Verbose "Found $($solutions.CrmRecords.Count) solutions/patches for $parentSolution"
if ($solutions.CrmRecords.Count -ge 1) {
$minMax = $solutions.CrmRecords | % { [Version]$_.version } | Measure-Object -max -min
$v = [Version]$minMax.Maximum
$newVersion = [Version]::new($v.Major, $v.Minor, $v.Build+1, 0)
Write-Verbose "Current max version: $($minMax.Maximum)"
Write-Verbose "Using $newVersion for $PatchName"

$patchDetails = @{
ParentSolutionUniqueName = $parentSolution
DisplayName = $PatchName
VersionNumber = $newVersion.ToString()
}
Write-Verbose 'Creating patch ...'
$result = Invoke-CrmAction -conn $conn -Name CloneAsPatch -Parameters $patchDetails

return $result

} else {

throw "No matching parent solutions found for $PatchName"

}

}

END { }
}

#ImportSolutionToCrmAsync
function Import-CrmSolutionAsync {
# .ExternalHelp Microsoft.Xrm.Data.PowerShell.Help.xml
Expand Down