Forms: How to add unique number to the subject of submissions

Ever lose track of Form submissions because they all have the same subject? We have a simple solution that automatically assigns a unique number to each submission :raising_hands:

Add the Hidden field to your form


Copy the ID of the Hidden field and add it to the Subject field in the Notify Me section


Adding the code to the Custom JS

Add the code below to the Custom JS section on the Settings tab:

function formatDateTime() {
    const now = new Date();
    
    const day = String(now.getDate()).padStart(2, '0');
    const month = String(now.getMonth() + 1).padStart(2, '0');
    const year = String(now.getFullYear()).slice(-2);
    const minutes = String(now.getMinutes()).padStart(2, '0');
    const seconds = String(now.getSeconds()).padStart(2, '0');

    return `[${day}${month}${year}${minutes}${seconds}]`;
}

const date = formatDateTime();
widget.setFieldValue('[current-date]', date)

Replace current-date in the last line of the code with the actual ID of your Hidden field


Guys, was this solution helpful to you? Share your experience in the comments :wink:

3 Likes