How to Prevent Duplicate Forms?

Hi,

I have a form that is used to collect customer satisfaction data. I pass it the servicedesk ticket number as parameter as follows:

https://xyz.sharepoint.com/teams/CustomerSatisfaction/SitePages/PlumsailForms/CSS%20Feedback%20Form/Item/NewForm.aspx?Ticket=123435

However the user can if they want click on the link and submit a form more than once for the same ticket number. Is there a way to prevent this?

Many Thanks

Andrew

Hello @ATerry,

You can check whether the feedback for the specific ticket exists or not using PnP js and if yes, for instance, redirect a user to a Form set with the error message.

image
Add the code to the Custom Routing section:

var web = new Web('Site URL');
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const ticket = urlParams.get('Ticket');

if(ticket){
return web.lists.getByTitle('List Name').items.select("Title").filter("Title eq '" +  ticket + "'").get().then(function(item) {
    if(item.length > 0) {
        return 'c46596f4-3325-43d5-86f9-77fc72d52ad4'
    }
});