When user opens a new case, I need to check if the serial number of the new case already exists in order to change the priority of the case. I use Kaskela's solution to do this and I think the best way to do it is to use query to get a single value (what I actually want to get is a true or false boolean)
this is the fetchXML I use
<fetch mapping='logical'>
<entity name='case'>
<attribute name='title'/>
<filter type='and'>
<condition attribute='abc_serialnumber' operator='eq' value='DYN_serialnumber' />
</filter>
</entity>
</fetch>
I get the error
An exception System.FormatException was thrown while trying to convert input value 'SN00105GH' to attribute 'case.abc_serialnumber'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
I get that it needs serial number's GUID which I can't use since it is in another entity.
I have two questions: Is query to get a single value the proper way to achieve what I want? Why does it need GUID?