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
});
});
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;
});
});