private/ConvertTo-SfGlobalValueSetTranslationXml.ps1
|
function ConvertTo-SfGlobalValueSetTranslationXml { [CmdletBinding()] param ( [Parameter(Mandatory, Position=0)] [pscustomobject] $ValueSet, [Parameter(Mandatory, Position=1)] [string] $LanguageCode, [Parameter(Mandatory)] [PSCustomObject[]] $PicklistValues ) $ErrorActionPreference = 'Stop' [bool] $IsDebug = $DebugPreference -ne 'SilentlyContinue' [bool] $IsVerbose = $VerbosePreference -ne 'SilentlyContinue' $PicklistValues = $PicklistValues | Where-Object { ($_._ValueSetType -eq 'GlobalValueSet') -and ($_._ValueSetName -eq $ValueSet._Name)} | Sort-Object _Label $xml = '<?xml version="1.0" encoding="UTF-8"?>' $xml += '<GlobalValueSetTranslation xmlns="http://soap.sforce.com/2006/04/metadata">' foreach ($PicklistValue in $PicklistValues) { $xml += ConvertTo-SfPicklistValueTranslationXml $PicklistValue $LanguageCode } $xml += '</GlobalValueSetTranslation>' return $xml } |