Quantcast
Viewing all articles
Browse latest Browse all 2791

FetchXML Parameter Cannot be compared to a Guid

Visual Studio 2008 BIDS In a CRM report, there is a drop-down to select a given account from the CRM database. For the account selected by the user, the report is to give the list of all contracts tied to that specific account.In Visual Studio I created a report with a Fetch XML connection. This is the definition of the dataset:[font="Courier New"][code="xml"]. <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="contract" enableprefiltering="true" prefilterparametername="CRM_Filteredcontract"> <attribute name="contractnumber"/> <attribute name="title"/> <attribute name="customerid"/> <attribute name="totaldiscount"/> <attribute name="netprice"/> <attribute name="statecode"/> <attribute name="activeon"/> <attribute name="expireson"/> <attribute name="duration"/> <attribute name="transactioncurrencyid"/> <filter type="and"> <condition attribute="customerid" operator="eq" value= "Parameters!CRM_Filteredcontract.Value" /> </filter> <order attribute="activeon" descending="true" /> </entity>[/font][/code][font="Arial"]The parameter is obtained by selecting one item in the list generated by this second dataset:[/font] [font="Courier New"][code="xml"] <version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="account"> <attribute name="accountnumber"/> <attribute name="name"/> <attribute name="accountid"/> <order attribute="name" descending="false" /> </entity> </fetch>[/font][/code][font="Arial"]The parameter data type is defined as text -- a GUID is not listed in the data type picklist. In Available values: the field chosen for Value is "accountid" example: [/font][font="Courier New"]4e85889a-89e5-e211-bdd0-005056af2e0f[/font] and the field chosen for Label is "name" example: My First Company.[font="Arial"]Running the query yields this error message:[/font][font="Courier New"]An exception System.FormatException was thrown while trying to[b] convert input value 'Parameters!CRM_Filteredcontract.Value}' to attribute 'contract.customerid'[/b]. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).[/font][font="Arial"]The "accountid"[/font] [font="Courier New"]4e85889a-89e5-e211-bdd0-005056af2e0f [/font] [font="Arial"][b]LOOKS[/b] like a GUID and so do the field "customerid" and the parameter when printed (after disabling the[/font] [font="Courier New"]<condition attribute="customerid"[/font][font="Arial"]).All examples I have found are unsatisfactory because it is a hard-coded constant that is used for the filter value, such as[/font] [font="Courier New"]<condition attribute=statecode operator=eq value=1" />[/font][font="Arial"]I have tried adding curly braces around the Parameter!...Value, I have tried casting the Parameter as System.Guid, I have tried changing the Parameter data type in the report xml code view, I have tried using expressions. VS rejects all such attempts.So how can this be made to work ?[/font]

Viewing all articles
Browse latest Browse all 2791

Trending Articles