system.perspective.openPopup() with Date Parameter

I have a popup view with a parameter named “startDate” which is bound to a DateTime Input component on the popup view.

For testing purposes, I have another view with two buttons: one that uses the Popup action to open the popup view with the “startDate” set to the value of a DateTimePicker component on the test view, and another that uses the system.perspective.openPopup() function with the “startDate” parameter set to a date obtained with the system.date.getDate() function. Following is a snippet of the script:

startDate = system.date.getDate(2020, 6, 4)
system.perspective.openPopup(“myPopupView”,‘PopupView’, params = {‘startDate’:startDate}, showCloseIcon = True, modal = True)

When I show the popup view with the Popup action button, everything works as expected, i.e., the DateTime Input has the value specified in the parameter “startDate”. When I show the popup view with the system.perspective.openPopup() function, the DateTime Input does not have a value.

Does anyone have an idea of what I may be doing wrong in the latter case?

It looks like the format the date is returned in from getDate() is not a format the DateTime Input will accept for its value.

Expected format: 1594926000000 (Unix time stamp, which we pretty-print as a Date object)
What you’re providing from system.date.getTime(): Java Date Object.

Try this:

startDate = system.date.getDate(2020, 6, 4).getTime()
system.perspective.openPopup("myPopupView","PopupView", params={"startDate":startDate}, showCloseIcon=True, modal=True)

That does the trick. Thanks for the help!

1 Like