
Announcements
I have the following powershell and XML file, but when running them I get the output
tenant : Microsoft.Xrm.Sdk.OptionSetValue
exception_type : Microsoft.Xrm.Sdk.OptionSetValue
exception : 0.0.0.0
How do I get the value of the Microsoft.Xrm.Sdk.OptionSetValue?
$fetchXmlFile = "C:\temp\FetchExceptions.xml"
Connect-CrmOnlineDiscovery -InteractiveMode
$fetchXml = [xml](Get-Content $fetchXmlFile)
$result = Get-CrmRecordsByFetch -Fetch $fetchXml.OuterXml
$result.CrmRecords | Select-Object -Property tenant, exception_type, exception
<fetch mapping="logical" version="1.0">
<entity name="crec2_spoofexceptions" alias="spoof_exception">
<attribute name="crec2_tenant" alias="tenant"/>
<attribute name="crec2_exceptiontype" alias="exception_type"/>
<attribute name="crec2_exception" alias="exception"/>
</entity>
</fetch>
Hi @dtietze,
Your FetchXml looks correct, and the Get-CrmRecordsByFetch with the way you loop through the results looks good as well. I think your issue is with the way your read the FetchXml from the file. Try to simply declare the FetchXml in a PowerShell variable and re-run? Ex:
$fetch = "
<fetch mapping='logical' version='1.0'>
<entity name='cre7b_car' alias='car'>
<attribute name='cre7b_name' alias='name'/>
<attribute name='cre7b_optionset' alias='opstionset' />
</entity>
</fetch>
"
Hope this helps!