Copying List Item to Create New Item

Hello @teddy0bear,

You can save the data of a form to local storage and then populate a new form with it.

This is the code sample for the button click property:

//save form data to the local storage
localStorage.setItem('FormData', JSON.stringify(fd.data()));

//redirect to the new form
window.location.href = 'New Form URL';

And you need to add this code to the New form:

fd.spRendered(function() {
    var formData = localStorage.getItem('FormData')
    //check whether the local storgae has form data
    if (formData) {
        //populate form
        fd.data(JSON.parse(formData));
        //clear local storage 
        localStorage.removeItem('FormData');
    }
});
2 Likes