Copy link to clipboard
Copied
I need to set up an auto-fill date field that is the last day of the year based off of another date field but only if "Annual" box is checked. If "One-time Use" box is checked, I need the expiration date field to be selectable manually and not auto-fill. Is this possible?
Example: "Annual" box is checked and "Requested Start Date" field is entered as 1/23/23, I need the "Expiration Date" field to auto-fill as 12/31 of the same year as the Requested Start Date Field (so it would be 12/31/23). If someone selects 2/2/24 as start date, I need the expiration date field to be 12/31/24, etc. The expiration date always needs to be the last day of the year of the start date field, but ONLY if the "Annual" check box is selected.
Copy link to clipboard
Copied
Well yes, this is possible with a script. The best option is to use a calculation script in the Expiration Date field.
You really don't even need to use proper date calculations since the end date is well known. Just split the Requested Start Date Field to get the year, then use it to build the Expiration Date string.