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 🙂
![[Step by Step] Beginner : Create a PCF control and add it to a custom page](https://rajeevpentyala.com/wp-content/uploads/2024/12/image-49.png)
![[Step by Step] Configure and run 'Pipelines in Power Platform'](https://rajeevpentyala.com/wp-content/uploads/2024/08/image.png)

Leave a comment