Discussion posts and replies are publicly visible
Hi vijayanv , A dateTimefield is used for choosing a date and a time while a datefield is just for the date. Not sure what's your requirement but I would make that dateTimefield required forcing the user to enter a date and time or change that field to a datefield and update your ri!'s to type "Date". Since your ri!'s are of type "Date and Time", there's no possible way that you can save a value of type "date" into an ri! of type "Date and Time". That ri! will always return "Date and Time".
vijayanv
Have some default datetime value to display if user hasn't selected anything.
Below snippet would help you.
a!dateTimeField( label: "date and time", value: if( isnull( ri!datetime ), now(), ri!datetime ), saveInto: { ri!datetime, a!save( ri!date, todate( ri!datetime ) ) } )
Depending on the user/environment timezone, this can return a "Date and Time" in the future or past. IE: if the user's timezone setting is 12 hours ahead and they enter this value after 12:00PM than the value saved would be for the next day. I ran into an issue before where we were saving now() for a field and writing it to the DB and our DB was set to GMT while on the Appian side it would pull the result set as EST.