Clear Out Date/Datetime Field

⌛️ Clear date and time field from specified records.

1. Overview

This Interaction is designed to manage the clearing of specific fields. The clearing occurs on Edit, Save, or after a hard page refresh.

2. Example

This example illustrates how the Interaction handles the clearing of the date-closed field based on the values of the closed field. Additionally, it addresses the scenario where deleting the date manually results in a null value.

async function handler(clev) {
    let actions = [];

    let closed = clev.getValue("closed");
    let dateClosed = clev.getValue("date-closed");
    console.log(closed);

    if (closed === true && dateClosed.length == "") {
        actions.push(
            clev.setValue("date-closed", clev.moment().format("YYYY-MM-DD"))
        );
    } else if (closed === "false" || closed === false) {
        actions.push(clev.setValue("date-closed", null));
    }

    return clev.mergeAll(actions);
}

📌 Need Help?

If you require assistance or encounter any issues, please don't hesitate to contact us for further support.