Can you please run the below snippet and get the details.
===============================
Fields paramFields=rcd.getDataDefController().getDataDefinition().getParameterFields();
for(int i=0;i<paramFields.size();i++)
{
IParameterField paramField=(IParameterField)paramFields.get(i);
String paramName=paramField.getName();
if(paramName.equals("Security_Number"))
{
out.println("<BR>Is Optional Prompt"+paramField.getIsOptionalPrompt());
ParameterFieldType parameterType=paramField.getParameterType();
out.println("<BR>Param Type int value"+parameterType.value());
out.println("<BR>Param Type String value"+parameterType.toString());
}
=========================================
Would need to check the type of the parameter, as stated in the error, only report parameters can be optional.
Please run the test and share the results to narrow down the issue.
Also check the behaviour on the report from crystal report desgner as well.
Thanks,
Prithvi