fd.itemId value = null

I use the spSaved event to edit the title field, but with this form the value of fd.ItemId = null.
Title field in sharepoint stays blank
Any ideas ?

fd.spSaved(function() {
var currentdate = new Date();
var datum = currentdate.getFullYear()
var title = "Mailing -" + datum + "-" + fd.itemId;
pnp.sp.web.lists.getByTitle("Mailing").items.getById(fd.itemId).update({
Title: title
});
});

Hello @patokyo,

Welcome to Plumsail Community!

The form closes before the pnp request is executed.

Do you want to populate the current item field or update the item in another list?

If you need to update the item in another list, you can use the code from this post:

I would like to update the field in the current item. We're using 365

Hello @patokyo,

You can use this code to update the current item title:

fd.spSaved(function(result) {
    var redirect = result.RedirectUrl;
    result.RedirectUrl = null;
    var currentdate = new Date();
    var datum = currentdate.getFullYear()
    var title = "Mailing -" + datum + "-" + result.Id;
    pnp.sp.web.lists.getByTitle('Mailing').items.getById(result.Id).update({
      Title: title
    }).then(function(){
        console.log("Updated!");
        window.location.href = redirect;
    });
});

perfect it works, you're the best :smiley: