Crm 2011 Dialog - Query CRM Data, System.FormatException
-
Thursday, 30 June, 2011 7:23 AM
I was implemeneting a new Dialog Process in Crm 2011 and I wanted to search in another Entity for Customers. I use a Prompt and Response where the User can select the Year of registration, then the next Step is a "Query CRM Data" which then searches in the Year field of the Customer Entity based on the given value.
The issue is:
If I add 20 as year, then it works but (as you could guess) it will not return any data.
If I add 2011 as year, the Dialog will sumbit this value as 2'011 and it will recognize it as string (probably because of the ' ), allthough it's data type (in Dialog) is Integer. And in this case I get an System.FormatException, it says the Expected Type is System.Int32. Input string was not in a correct format.
I created a custom workflow activity (where I convert the 2'011 to int, because the submited Type is System.String), and I Search in the Custom Entity through this activity instead of using the "Query CRM Data" functionality of the Dialog. But it's very strange that the value is being submited as string even if it's Data Type is set to Integer.
Here are the Steps to reproduce:
1. Create a Custom entity and add a field of type Integer to it, call it "Search Column". Save the entity and add some sample data to it.
2. Create a new Dialog Process, add a Page to the Dialog, and then add a Promtp and Response called "Search demo", make its Type = Integer.
3. Add "Query CRM Data" to this Dialog Page, and configure it to Search the Column of the Custom Entity you created in Step 1.
Now you can Activate and Test this Dialog. If you add 20 or 200 as a Search Value it will work, but if you add 2000 it will not work, since the 2000 will be submited as string 2'000 and not as an Integer.
Is this a bug in Crm 2011, or I'm I doing something wrong?
Thanks in Advance
All Replies
-
Thursday, 30 June, 2011 8:38 AM
Hi Besir,
First of all - this is a german forum so your post is actually at the wrong position :-) ! English forum
Nevertheless I want you give a tipp for your problem: Try to set a FormatProvider when you convert the string to int - with a FormatProvider the TypeConverter should probably delete the "special sign" of the string value.
Regards,
Andreas
Andreas Buchinger
Microsoft Dynamics Certified Technology Specialist
MCPD: SharePoint Developer 2010 -
Thursday, 30 June, 2011 8:52 AM
Hi Andreas,
Thanks for your Tipp about the Forum. I will ask the Question in the English Forum.
Regarding the question. I dont see a posibility to do that in the Dialog. The Data Type for the Prompt and Response is Integer,but if I add a 4 digit number, it will be submited as string, and it throws the exception. I can convert it in code, which I also did and it works. But it should work also out of the Box with the Query CRM Function. Either I'm missing something, or this could be a bug in CRM 2011.
Thanks & BR
Besir
B. Kasami