Closed dylanhaskins closed 1 year ago
I hit the same error - I then tried to build out the fetch query and use Get-CrmRecordsByFetch directly, and same behaviour. It works fine if it successfully retrieves data, throws this error if there are no results
Let me see if I can reproduce this - thanks for the info, it looks like it's if works fine but errors if there are no results (which is definitely not intended). I just looked back at the PR's and I don't see any changes that would have caused this, it makes me wonder if something in the XRM SDK Connector changed - will look there next.
Ok, I think what happened in the previous assemblies is the connector SDK would write a warning when there were no results and now that isn't taking place anymore, I wonder if something changed around what was written to the pipeline when there were no results (that's my best hypothesis right at the moment). Anyhow, it would be good to have null checks here anyhow, so I'll add those and continue to wonder what exactly changed to cause this change - I'm a little perplexed why this works as it does in the .14 version but will prioritize fixing the issue we're seeing now.
I've published an alpha build/pre-release package - are either of you able to test out and validate if the fix works for you? I'm relatively certain this will resolve it as I was able to reproduce. I still don't have a good idea for why this is taking place now and not in prior builds. I'm almost positive it has something to do with the updated assembly - the code for both functions remained the same in both releases but I can't repro in .14 and I can reproduce it in the newer build.
I should be able to give it a try tomorrow, will let you know!
Thanks Sean.
I can confirm that the 2.8.19-alpha release is working in our scenarios 😊
Thanks for confirming!
Hey Team,
Sent a message via PowerShellGallery, but I am not sure that those work, so thought I would log the issue here too. With 2.8.17 Get-CrmRecords has stopped working when Filtering. It appears to parse the filters and send them to Get-CrmRecordsByFetch but results in an error. Below is an example using the "example call" provided in your Get-Help documentation, but seeing the same error with all filtered queries that we have been using ....
PS C:\Users\dhaskins> Get-CrmRecords -conn $Conn -EntityLogicalName account -FilterAttribute name -FilterOperator "eq" -FilterValue "Adventure Works (sample)" -Fields name,accountnumber -Verbose VERBOSE: Using the supplied single filter of name 'eq' Adventure Works (sample) Get-CrmRecordsByFetch : System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'records' because it is null. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) At C:\Users\dhaskins\Documents\WindowsPowerShell\Modules\Microsoft.Xrm.Data.PowerShell\2.8.17\Microsoft.Xrm.Data.Powershell.psm1:3327 char:20
At C:\Users\dhaskins\Documents\WindowsPowerShell\Modules\Microsoft.Xrm.Data.PowerShell\2.8.17\Microsoft.Xrm.Data.Powershell.psm1:1696 char:9