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 🙂

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: