Question
How to set default value for a datetime field of tomorrow's date
13:32 Feb 24, 2023
Hello Community,
How can we set the default value for a Datetime field to the tomorrow's date?
Thanks
Gargeyi.G
20:47 Feb 24, 2023
I don't believe you can set a default for tomorrow's date in the object property defaults (unless you add it in the entity code).
It's done pretty easily on the page if you want to add the code there, it would look like this (for a Freedom UI page):
handlers: /**SCHEMA_HANDLERS*/[ { request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { const result = await next?.handle(request); const cardState = await request.$context.CardState; if (cardState == "add" || cardState == "copy") { request.$context.TheDateFieldAttribute = Terrasoft.utils.date.addDays(new Date(), 1); } return result; } } ]/**SCHEMA_HANDLERS*/,
Ryan
18:01 Mar 06, 2023
Ryan Farley,
Thank you, it worked
Show all comments