Prefilling a "Date" page element

Prefilling a date question requires the date to be passed to the Date page element in YYYY-MM-DD format. How this is achieved depends on where the date is coming from. In some cases 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 Textfield see Prefilling a Textfield with a date.

From CXM

There are two different types of date that can be retrieved from a CXM, a Case Date and Case Field.

Case Field

Begin by creating a form logic to get the Case Date from CXM. Use the CXM - Case date for a specific case logic, passing in the CXM case reference and choosing the case date field you want to use to prefill the date question.

  1. In your form, click Advanced > Logic in the top navigation bar (under the the form title).

  2. Click Add Logic. The create interface will open.

  3. Give the logic a name.

  4. Select Predefined as the logic Type.

  5. Choose CXM - Value of a field for a specific case as the Formula.

  6. Set the input CXM Case Reference to the question that will contain the case reference.

  7. Search for and select the field that contains a date in CXM in the Field.

  8. Select the most appropriate setting for Run as signed in user, this will typically be No.

    cxm-case-date-prefill-step1

  9. Click Save.

    The first logic you created will retrieve the field value from CXM for the CXM Reference Number in a localised format. This needs to be converted into a YYYY-MM-DD format so the Date page element can understand the date. To do this create a new logic using the Date plus/minus days logic.

  10. In your form, click Advanced > Logic in the top navigation bar (under the the form title).

  11. Click Add Logic. The create interface will open.

  12. Give the logic a name.

  13. Select Predefined as the logic Type.

  14. Choose Date plus/minus days as the Formula.

  15. Set the input format to "Site Locale". This will make sure that the date retrieved from the "CXM - Value of field for a specific case" logic is parsed correctly.

  16. Set the output format to YYYY-MM-DD.

  17. Set +/- to either plus or minus (it makes no difference when converting a date)

  18. Set the amount to 0

  19. Set the Weekdays or Days input to either Weekdays or Days (it makes no difference when converting a date)

    cxm-case-date-prefill-step2

  20. Click Save.

    Now setup the prefill using the second logic you created.

  21. In your form, click Advanced > Prefills in the top navigation bar (under the the form title).

  22. Click Add Prefill. The create interface will open.

  23. Select the question to be prefilled.

  24. Select the name of the logic as the value of the prefill.

  25. Click Save.

  26. The prefill will be created and added to the list.

    cxm-case-date-prefill-step3

Case Date

Begin by creating a form logic to get the Case Date from CXM. Use the CXM - Case date for a specific case logic, passing in the CXM case reference and choosing the case date field you want to use to prefill the date question.

  1. In your form, click Advanced > Logic in the top navigation bar (under the the form title).

  2. Click Add Logic. The create interface will open.

  3. Give the logic a name.

  4. Select Predefined as the logic Type.

  5. Choose CXM - Case date for a specific case as the Formula.

  6. Set the input CXM Case Reference to the question that will contain the case reference.

  7. Copy the Unique identifier for the Case Date from CXM and enter it into the CXM Case Date Field.

  8. Select No for Include time

  9. Select the most appropriate setting for Run as signed in user, this will typically be No.

    cxm-case-date-prefill-step1

  10. Click Save.

    The first logic you created will retrieve the CXM Case Date from CXM for the CXM Reference Number in a localised format. This needs to be converted into a YYYY-MM-DD format so the Date page element can understand the date. To do this create a new logic using the Date plus/minus days logic.

  11. In your form, click Advanced > Logic in the top navigation bar (under the the form title).

  12. Click Add Logic. The create interface will open.

  13. Give the logic a name.

  14. Select Predefined as the logic Type.

  15. Choose Date plus/minus days as the Formula.

  16. Set the input format to "Site Locale". This will make sure that the date retrieved from the "CXM - Case date for a specific case" logic is parsed correctly.

  17. Set the output format to YYYY-MM-DD.

  18. Set +/- to either plus or minus (it makes no difference when converting a date)

  19. Set the amount to 0

  20. Set the Weekdays or Days input to either Weekdays or Days (it makes no difference when converting a date)

    cxm-case-date-prefill-step2

  21. Click Save.

    Now setup the prefill using the second logic you created.

  22. In your form, click Advanced > Prefills in the top navigation bar (under the the form title).

  23. Click Add Prefill. The create interface will open.

  24. Select the question to be prefilled.

  25. Select the name of the logic as the value of the prefill.

  26. Click Save.

  27. The prefill will be created and added to the list.

    cxm-case-date-prefill-step3

From User Account

To use the user account date of birth to prefill a date question:

  1. In your form, click Advanced > Prefills in the top navigation bar (under the the form title).

  2. Click Add Prefill. The create interface will open.

  3. Choose the question to prefilled.

  4. Choose where the prefill value should come from e.g. the user account variable 'User - Date of Birth'.

    date-prefill-via-user-account

  5. Click Save.

  6. The prefill will be created and added to the list.

From URL Injection

To use URL parameter injection to prefill a date question:

  1. In your form, click Advanced > Prefills in the top navigation bar (under the the form title).

  2. Click Add Prefill. The create interface will open.

  3. Select the question to be prefilled.

  4. Select A URL parameter as the value of the prefill.

  5. Specify a key to pass the parameter under e.g. 'date'

    date-prefill-via-url

  6. Click Save.

  7. The prefill will be created and added to the list.

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:

  1. In your form, click Advanced > Prefills in the top navigation bar (under the the form title).

  2. Click Add Prefill. The create interface will open.

  3. Select the question to be prefilled.

  4. Select the logic from the dropdown list as the value of the prefill. 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.

    date-prefill-via-url

  5. Click Save.

  6. The prefill will be created and added to the list.

results matching ""

    No results matching ""