function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AyanHoreAyanHore 

conversion error in dynamic inputfield

Hi,

I'm trying to create a dynamic filter where the user can select any fields from a SObject to filter the data (something like the lookup filters). It is working fine, however, the below scenario throws an error:
If the inputField is having a previous value selected (say a String) and I selected a DateTime field in the filter, it tried to convert the string into DateTime and throwing a error. Below is the line in question:
<apex:inputField value="{!inputObj[FieldName]}" required="false" rendered="true" style="width:50%"/>
Getting the below error:.
Error: Value 'Provisional' cannot be converted from Text to DateTime
FieldName refers to the field API name. Any ideas on how to solve this would be very much appreciated.

~Ayan
 
Nitish KumarNitish Kumar
I think the best solution would be to clear the selected value whenever you are changing the filter criteria (changing the fields)
AyanHoreAyanHore
Thanks for replying Nitish. However, since I'm using a dynamic binding in the object, not able to clear off the field. Any help on this will be greatly helpful.