Set future date in a date type field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2024 01:45 PM
Hi,
I have the following question, based on the selection of a field (If the "No" option is selected), a date type field must be enabled already set with a date 2 years ahead.
My difficulty lies precisely in this logic of making this date type field perform this two-year calculation based on the current date.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2024 01:50 PM
If you need this to happen on the Client side, you will need a client script with a GlideAjax call and a Script Include. If this can happen after saving, then you can do this in a Business rule with no need for a Script include.
You can take whatever date you need and use the GlideDateTime().addYears() method to add years to whatever your original date (after converting it to a GlideDateTime object) is.
Here is a link to the docs page as well as a screenshot of the relevant section