Datefields cannot be forced to be null

316
2
03-08-2021 01:45 AM
RasmusHolstMikkelsen
New Contributor II

Hi.

I have made a Survey in S123 connect based on a current feature service, where the user should be able to change 3 different date fields (among other fields).

To make it more user friendly, i have made 4 buttons in an experience environment, where the date fields would be either today's date or null, as the 3 fields are connected (Reservation date, when the reservation will expire, and the date when the property is sold)

When there is a new reservation, the user will click the "Reservation" button, and the "Sold date" will become null, "Reservation" will be today's date, and "Reservation expires" will be today's date + 6 months.

My issue:

When the button is clicked, the following is hard coded into the Survey 123 link:

https://survey123link?mode=edit&globalId={globalID}&field:Status=Reserved&field:Solddate=null&field:Reservation={Today}&field:ReservationExpires={Today_6Month}&hide=field{someFields} 

This hardcoded link results in the following survey, where the "Solddate" would become null (Which works as intended): - Translated from Danish (Sorry)

 

RasmusHolstMikkelsen_2-1615196315330.png

However, when you click the submit button i get the following error:

RasmusHolstMikkelsen_3-1615196373217.png

Which i would roughly translate into: "The survey contain errors: 1. Click here to navigate to each error".

So for some reason it is not possible to send Null data to a datefield? Does anybody know why? - The field(s) can contain Null values in the database. The 3 date fields all have the bind::esri:fieldType of esriFieldTypeDate in the S123 excel spreadsheet.

0 Kudos
2 Replies
IsmaelChivite
Esri Notable Contributor

Did you try removing &field:Solddate=null completely from your link?

If you do not set a default value in your date question, it will appear empty and if not completed by the user a null value will be stored in the feature layer.

0 Kudos
RasmusHolstMikkelsen
New Contributor II

That works completely fine, however, as the feature service is editable, the "&field:Solddate=null" was my way of trying to reduce the amount of clicks when editing the data. Therefore, if i don't set "solddate=null", the original date will still appear, if already set, and it would then have to be changed manually 🙂 

I want to be able to remove the original date stored in one of the date fields, without the user needing to delete/remove the data manually.

0 Kudos