- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 10:20 AM
I have a requirement like if existing end date is auto populated based on the Gid selection, I need to add 1 day to the existing end date and populate that date in New field called New start date.
Please suggest thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 10:27 AM
@pdisrilatha Please check if the following script works for you.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Get the date from the field (assuming it's in yyyy-MM-dd format)
var originalDate = new Date(newValue);
// Add one day (24 hours * 60 minutes * 60 seconds * 1000 milliseconds)
originalDate.setDate(originalDate.getDate() + 1);
// Format the date back to yyyy-MM-dd
var dd = String(originalDate.getDate()).padStart(2, '0');
var mm = String(originalDate.getMonth() + 1).padStart(2, '0'); // January is 0!
var yyyy = originalDate.getFullYear();
var newDate = yyyy + '-' + mm + '-' + dd;
// Set the new date back to the field
g_form.setValue('your_date_field', newDate);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 10:27 AM
@pdisrilatha Please check if the following script works for you.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Get the date from the field (assuming it's in yyyy-MM-dd format)
var originalDate = new Date(newValue);
// Add one day (24 hours * 60 minutes * 60 seconds * 1000 milliseconds)
originalDate.setDate(originalDate.getDate() + 1);
// Format the date back to yyyy-MM-dd
var dd = String(originalDate.getDate()).padStart(2, '0');
var mm = String(originalDate.getMonth() + 1).padStart(2, '0'); // January is 0!
var yyyy = originalDate.getFullYear();
var newDate = yyyy + '-' + mm + '-' + dd;
// Set the new date back to the field
g_form.setValue('your_date_field', newDate);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 11:09 AM
Thanks, it is really help full to me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 01:42 AM
I need help in portal if you have any idea, please look into another post their requirement is clear mentioned.