Problem passing a parameter from a Report to CRM

Skip to first unread message


Dec 5, 2007, 10:57:02 AM12/5/07
Hi, I'm trying to show a company forecast in an iFrame, the report runs fine
on the server and even through the Reports section in CRM.

This is the code I am using on the OnLoad event of the form that the iFrame
is in:


var url =
var Close_Date_Filter = crmForm.all.new_closedate.DataValue
var param = "&rc:parameters=false"
url = url+Close_Date_Filter+param


The parameter is set to hidden on the report so I can pass it from the field
however when I try to open the iFrame I get the following error:

The value provided for the report parameter 'Close_Date_Filter' is not valid
for its type. (rsReportParameterTypeMismatch)

I don't understand what the problem is, the field it is referencing is a
date field, I've even tried it as a date/time field but get the same error.

Richard Riddle

Dec 5, 2007, 12:19:04 PM12/5/07
CRM stores the date as a date/time and all the information is included in the
field on the form, even if it's not all displayed. add this line to the
onload event of your form: alert(crmForm.all.new_closedate.DataValue)

to see exactly what's in the field and what you are passing to SRS. I
believe you will see the day, date, time and time zone, which SRS can't
manipulate into a date.

If you stuff the date field DataValue into a new date() in JavaScript, you
can extract the appropriate data and format it correctly for SRS.

Richard Riddle
CRM Developer


Dec 5, 2007, 12:35:34 PM12/5/07
Hi Richard,

Yes you're right, CRM passes through the following: Day, Month, Date, Time,
Time Zone, Year.

I'm a bit of an amateur when it comes to java, if you could explain your
last paragraph in more detail it would be much appreciated!!!

Richard Riddle

Dec 5, 2007, 12:57:01 PM12/5/07

replace your Close_Date_Filter declaration with the two lines below

var closeDate = new Date(crmForm.new_closedate.DataValue);
var Close_Date_Filter = closeDate.getMonth() + 1 + "/" + closeDate.getDate()
+ "/" + newDate.getFullYear();

I don't know if SRS will accept that as a date parameter through a url; i
didn't test it. Also, when doing the report, make sure you are using a view
as your source. CRM stores dates in UTC, so if you go off the table itself,
you may get unexpected results.

Reply all
Reply to author
0 new messages