Home > Power Platform > Xrm.Data.Powershell | Get-CrmRecordsByFetch | White space is not allowed before the string terminator.PowerShell

Xrm.Data.Powershell | Get-CrmRecordsByFetch | White space is not allowed before the string terminator.PowerShell

While executing Get-CrmRecordsByFetch operation in PowerShell using Microsoft.Xrm.Data.PowerShell library, I encountered

White space is not allowed before the string terminator.PowerShell error.

Reason:

  • Issue was with the format of ‘FetchXML’ being passed to Get-CrmRecordsByFetch operation.
  • There should not be a space before closure “@ tag.
  • Following does not work as there is space before the closure “@ tag of $fetch variable.

Fix:

  • Fix is simple, remove the space before the “@ tag of $fetch variable.
  • Following works.

Sharing this trivial Issue as it was annoying and took sometime to fix 🙂

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment