Binding Service Variable of type Datetime to a query parameter results in undefined

Updated post to reflect actual issue [14-03-23]
When binding Service Variable of type Datetime to a query parameter with validation, the Datetime value results in ‘undefined’.


Set input validation to ‘None’ until future release fixes this issue.

Original post

I am trying to set up a simple service that sends some data when called upon. The data read into a runtime data source should be filtered on its created date based on an input parameter called “from date”. I am trying to use the built-in createdDate parameter for this filter but then nothing gets read to the data source (see the below image for setup).

For testing purposes, I have tried using another “custom” dateTime-property. This returns data so it doesn’t seem that the service setup is the issue.

This might be a bug(?), and a workaround could be to create another custom “created date” parameter but that doesn’t feel like the best solution here. Any ideas on why this is happening and how to get it to work as intended?


The Service Variabels.From date, how is this value set? Does it get a default value on create? And how far back in time is this value set to?

Does it look like this?

Running some more tests on this, it is not the Created Date property that is the issue. Having the same setup as you and without using a query parameter I am getting some data. The issue appears to be the query param (see image below for setup).

When setting the query param to any ISO 8601 datetime value (e.g. “2023-03-01T00:00:00.001Z” (without quotes)) - and using log to console - printing Service Variabels.From date resolves in ‘undefined’. So it’s a different issue than originally assumed. Any ideas?


For a temporary workaround, I was able to get the data requested using a Service Variable of type String as the query parameter:


With this setup and using the ‘Update Object’ action on the Service Variable Data Source, I get the desired result by running the code below:

const momentObj = moment(fromDateAsString);
const isoString = momentObj.toISOString();
return isoString;

I changed my setup to look like yours with a datetime field and was able to console log the date from the query param.

My current setup:

Skjermbilde 2023-03-14 kl. 08.25.12

This setup will read 4 objects, but also console log the date from the query param.

NB, the From date field should no longer have a “value on create”

Can you spot any difference between our two setups? :smiley:

It appears that the issue occurs when ‘Validation’ is set on the query parameter.

Turning the validation off results in correct execution:

But when turning the validation on (any value other than ‘none’), the Service Variable of type datetime results in ‘undefined’:

Good catch!
We actually have a closed challenge registered on that.
So this is fixed in a future release.

1 Like