- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 08:31 AM - edited 02-27-2023 08:42 AM
I have a 'arrival date' that I would like to repopulate the date to the current day. I would place the code in my init function so when the page loads the date is already applied. How can I achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 09:13 AM
@asher14 ,
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = mm + '-' + dd + '-' + yyyy;
g_form.setValue('Backend_Name_of_field' , today );
//alert(today)
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 08:38 AM - edited 02-27-2023 08:39 AM
@asher14 ,
Tried & Tested in client script
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = mm + '-' + dd + '-' + yyyy;
alert(today)
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 08:44 AM
is alert a pop up? I want the value to display on the 'u_arrival_date' field value on the service portal widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 08:52 AM
@asher14 ,
If you are working in native view client script, please use
g_form.setValue('Backend_Name_of_field' , DATE);
Please share the snippet where you are writing this script if it is not working!
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 09:08 AM
g_form.setValue('Backend_Name_of_field' , DATE);
is date identifying as whatever the current date is?