How do I add a datestamp to survey responses ?

This is a little trickier to achieve than it would appear at first sight.

Entering 

today()

as the value in a Property like this : -

does not datestamp when the survey response was created, but instead, the date when the dataset with this new entry was first opened.

Here is what you need to do.

1  Determine the 'dataset ID'. From within the dataset where the survey responses are being collated, enter the expression shown below in the Expression section and copy the result using the Copy icon top right of the box : -

2  Add a createdDate property to the dataset of interest.

3  Close the dataset (very important).

4  Open a server-side gizmo window in the correct environment and tenant by entering this URL in your browser's address bar : -

https://{your-orgvue-environment}.concentra.io/{your-tenant-id}/gizmo

replacing "{your-orgvue-environment}" and "{your-tenant-id}" with the real values.

  • There are a number of OrgVue environments. Yours can be determined from the URL where you normally access OrgVue, eg. orgvue.eu-west-1.concentra.io. A full list of OrgVue environments is available here.
  • To determine your Tenant ID enter https://{your-orgvue-environment}/tenants/tenants in your browser's address bar.

5  Paste the following code into the Gizmo window (being careful to substitute the dataset ID you determined at step 1 above in place of "YOUR-DATASET-ID-HERE") and click 'Evaluate'.

var targetDataset = resource.dataset("YOUR-DATASET-ID-HERE")
targetDataset.events()
.filter(e => e.event == "CreateItemEvent")
.map(e => targetDataset.update(e.id, { createdDate: e.dateTime }))

6  Your dataset will now show the date on which a survey response was received. Note that this process can be run at any time and it will populate all records in the dataset.

Have more questions? Submit a request

Comments