From f68cfc90277c4c02c4733b205557100bf9e76438 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 10 Oct 2018 16:42:03 -0500 Subject: [PATCH 1/2] Excluded additional object properties from get systemsettings retrieve by fetch logic. Longer term we may wish to consider going away from serializaing these inside the function and, instead, rely on the object returned from get-CrmRecordsByFetch --- .../Microsoft.Xrm.Data.PowerShell.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 b/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 index da4e02a..77170b2 100644 --- a/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 +++ b/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 @@ -3470,7 +3470,7 @@ function Get-CrmSystemSettings{ foreach($att in $record.original.GetEnumerator()) { - if(($att.Key.Contains("Property")) -or ($att.Key -eq "organizationid")) + if(($att.Key.Contains("Property")) -or ($att.Key -eq "organizationid") -or ($att.Key.StartsWith("ReturnProperty_")) -or ($att.Key -eq "logicalname") -or ($att.Key -eq "original")) { continue } From 03ce659fcfd8add8426b467f5ddaaa0077f0d72a Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 10 Oct 2018 16:46:35 -0500 Subject: [PATCH 2/2] Added null check on the name property to avoid this in the future --- .../Microsoft.Xrm.Data.PowerShell.psm1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 b/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 index 77170b2..4d51cf4 100644 --- a/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 +++ b/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1 @@ -3518,7 +3518,13 @@ function Get-CrmSystemSettings{ { $name = ($attributes | where {$_.LogicalName -eq $att.Key}).SchemaName } - Add-Member -InputObject $psobj -MemberType NoteProperty -Name $name -Value $record.($att.Key) + + if($name -eq $null){ + Write-Warning "SKIPPING Property: $($att.Key)" + } + else{ + Add-Member -InputObject $psobj -MemberType NoteProperty -Name $name -Value $record.($att.Key) + } } return $psobj