Skip to main content

Prefilling a date field with a date

Prefilling a date question requires the date to be passed to the Date element in YYYY-MM-DD format.

How this is achieved depends on where the date is coming from. Where the date is in a non YYYY-MM-DD format you'll need to transform the date using the date plus/minus days logic.

note

This page is for prefilling a Date question, to prefill a date into a Text field see Prefilling a Text field with a date.

From User Account

To use the user account date of birth to prefill a date question, add a prefill and prefill the date element with the User - Date of Birth value.

From URL Injection

To use URL parameter injection to prefill a date question, add a prefill and prefill the date element with the A URL parameter value, specify a key to pass the parameter under e.g. 'date'.

Access the form with ?date=YYYY-MM-DD on the end of the URL. Ensure the date is passed in YYYY-MM-DD format.

From a Logic

To use the result of a logic to prefill a date question, add a prefill and prefill the date element with the logic from the dropdown list as the value.

Ensure the result of the logic is in YYYY-MM-DD format. Use converting the format of a date for instructions on converting a date to the correct format.

From Jadu Connect

There are two different types of date that can be retrieved from a Jadu Connect.

Case Field

  1. Add logic to your form to get the case field value from Jadu Connect using the Case value predefined logic.
  2. Create another logic to convert the data format to YYYY-MM-DD using the Date plus/minus days.
    • Set input format to Site Locale.
    • Set output format to YYYY-MM-DD.
    • Set +/- to either plus or minus (it makes no difference when converting a date)
    • Set the amount to 0
    • Set the Weekdays or Days input to either Weekdays or Days (it makes no difference when converting a date)
  3. Add a prefill and prefill the date element with the value from the logic in step 2

Case Date

  1. Add logic to your form to get the case date from Jadu Connect using the Case date predefined logic.
    • Set Connect Case Reference to the question that will contain the case reference
    • Set CXM Case Date Field to the Unique identifier value for the Case Date from Jadu Connect
    • Set Include time to No
    • Run as signed in user should usually be set to No
  2. Create another logic to convert the data format to YYYY-MM-DD using the Date plus/minus days.
    • Set input format to Site Locale.
    • Set output format to YYYY-MM-DD.
    • Set +/- to either plus or minus (it makes no difference when converting a date)
    • Set the amount to 0
    • Set the Weekdays or Days input to either Weekdays or Days (it makes no difference when converting a date)
  3. Add a prefill and prefill the date element with the value from the logic in step 2