š Update end times dynamically.
1. Overview
This interaction is designed to update the End Date field based on changes made to the Duration field.
2. Example
This interaction triggers when changes are made to the Duration field.
- It retrieves the values of the
Start DateandDurationfields using agetValue()function. - If both the
Start DateandDurationvalues are available, it pushes an action to set theEnd Datefield with the calculatedEnd Date(in "YYYY-MM-DD" format) using asetValue()function.
startDate = May 2, 2023
duration = 1 days
endDate = May 3, 2023
async function handler(C) {
let actions = [];
let startDate = C.getValue("1662670-start-date");
let duration = C.getValue("1662670-duration");
let endDate = C.moment(startDate)
.add(duration, "days")
.format("YYYY-MM-DD");
if (startDate && duration) {
actions.push(C.setValue("1662670-end-date", endDate));
}
return C.mergeAll(actions);
}š Need Help?
