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] Configure and consume 'Environment Variables' of type 'Secret' using 'Azure Key vault'](https://rajeevpentyala.com/wp-content/uploads/2023/05/image.png)
Leave a comment