Ideas for a ID numbering system

Does anyone have an idea for making a unique ID numbering system that will work even on a new form?

The SharePoint id is null on a new form so I can't us it. I considered a Flow to create the ID but that can get stuck in an infinite loop.

Any ideas?

Use another list to keep your numbers and then pull in the last number in the form...Do a calculation to +1
Set that as your ID and also update the other List on Save....That should work as long as users have contribute to both list.

1 Like

Hi @smithme
I had a similar requirement and implemented this using the spSaved event. The code below executes after the item was saved, retrieves the SharePoint item ID and I update the Title field with a unique reference.

fd.spSaved(function(result){
    //Get the current list ID
    var listId = fd.spFormCtx.ListAttributes.Id;
    //Get the saved item ID
    var itemId = result.Id;

    //Get a value from one of the drop down fields
    var site = fd.field('Site').value.Cost_x0020_Centre;
    //Compose a unique reference
    var title = "FC-" + site + "-" + itemId;
    //Get the SharePoint list
    var list = pnp.sp.web.lists.getById(listId);
    //Update the saved item
    list.items.getById(itemId).update({
        Title: title,
        Status: "Open"
    }).then(function() {
        console.log('New Item Id', itemId);
    });
});