Microsoft.Xrm.Data.PowerShell icon indicating copy to clipboard operation
Microsoft.Xrm.Data.PowerShell copied to clipboard

Not able to filter workflow entity

Open fuentej opened this issue 6 years ago • 2 comments

Running the following command produces an error.

(Get-CrmRecords -EntityLogicalName workflow -FilterAttribute primaryentity -FilterOperator eq -FilterValue contact -Fields * -AllRows).CrmRecords

Get-CrmRecordsByFetch : System.Management.Automation.RuntimeException: ************ FaultException`1 - RetrieveMultiple : GetEntityDataByFetchSearch |=> An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format.

I am not aware of a way to find out the correct int32 value.

This happens on most attributes of the workflow entity, I have not tried on other entities.

Full error below: Get-CrmRecordsByFetch : System.Management.Automation.RuntimeException: ************ FaultException`1 - RetrieveMultiple : GetEntityDataByFetchSearch |=> An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6C9ED3DC[TerminalFailure] Failed to Execute Command - RetrieveMultiple : RequestID=0af2b909-5b5c-4a01-ad62-003df9be52f8 : GetEntityDataByFetchSearch duration=00:00:00.2801244 ExceptionMessage = An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6C9ED3DC At C:\Program Files\WindowsPowerShell\Modules\Microsoft.Xrm.Data.Powershell\2.8.4\Microsoft.Xrm.Data.Powershell.psm1:3259 char:20

  • ... $results = Get-CrmRecordsByFetch -conn $conn -Fetch $fetch -AllRows
  •              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-CrmRecordsByFetch

************ FaultException`1 - RetrieveMultiple : GetEntityDataByFetchSearch |=> An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6C9ED3DC[TerminalFailure] Failed to Execute Command - RetrieveMultiple : RequestID=0af2b909-5b5c-4a01-ad62-003df9be52f8 : GetEntityDataByFetchSearch duration=00:00:00.2801244 ExceptionMessage = An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6C9ED3DC At C:\Program Files\WindowsPowerShell\Modules\Microsoft.Xrm.Data.Powershell\2.8.4\Microsoft.Xrm.Data.Powershell.psm1:1586 char:4

  •         throw LastCrmConnectorException($conn)
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (************ Fa...port: #6C9ED3DC:String) [], RuntimeException
    • FullyQualifiedErrorId : ************ FaultException`1 - RetrieveMultiple : GetEntityDataByFetchSearch |=> An exception System.FormatException was thrown while trying t o convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correc t format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: Sys tem.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatExceptio n: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Referen ce number for administrators or support: #6C9ED3DC[TerminalFailure] Failed to Execute Command - RetrieveMultiple : RequestID=0af2b909-5b5c-4a01-ad62-003df9be52f8 : GetEn tityDataByFetchSearch duration=00:00:00.2801244 ExceptionMessage = An exception System.FormatException was thrown while trying to convert input value 'contact' to attrib ute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: Sys tem.Int32. Exception raised: Input string was not in a correct format. => An exception System.FormatException was thrown while trying to convert input value 'contact' to attribute 'workflow.primaryentity'. Expected type of attribute value: System.Int32. Exception raised: Input string was not in a correct format. => System.FormatExceptio n: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at Microsoft.Crm.Platform.ConvertHelper.FromXmlString(AttributeMetadata attributeMetadata, String xmlString): Microsoft Dynamics CRM has experienced an error. Referen ce number for administrators or support: #6C9ED3DC

fuentej avatar Jan 24 '20 16:01 fuentej

For contact it's 2. List of object type codes for standard entities: http://www.dynamicscrm.blog/object-type-codes-cheat-sheet-for-dynamics-365/ How to query for all object type codes in your organization: http://siddiquemahsud.blogspot.com/2017/03/get-object-type-code-for-entities-in.html

sergeytunnik avatar Jan 27 '20 10:01 sergeytunnik

Thanks!

fuentej avatar Feb 05 '20 00:02 fuentej