Hi All,
I'm pretty new to plumsail but getting there slowly and hope to get some help here.
I would like to update another list with the new itemid record returned after i click the save button
.
As you can see below in my fd.spBeforeSave it works no issue but i can't get to retrieve the new itemid
But in the fd.spSaved I can get the newly created itemId but i can't get to retrieve some field values that i need to update in the other list
How can i achiwve this and thanks in advance
fd.spBeforeSave(function () {
//It seems i can't get the itemid that was newly created here in the fd.spBeforeSave
//var itemId = result.Id;
//console.log(itemId);
var Status = "Yes";
//But i can get the field values from my form
var RecordID = fd.field('RecordID').value;
update(FormURL,Status,RecordID);
});
fd.spSaved(function (result) {
//It seems i can get the itemid that was newly created here in the fd.spSaved
//var itemId = result.Id;
//console.log(itemId);
//But i can't get this field values from my form here in the fd.spSaved
var RecordFKID = fd.field('RecordID').value;
var Status = "Yes";
var RecordFKID = fd.field('RecordID').value;
update(siteFormURL,Status,RecordID);
});
Thanks for the prompt reply mnikitina.
I know how to update and i have a function called update in my original post.
See below
function update(FormURL,Status,RecordFKID) {
let web = new Web(FormURL);
var list = pnp.sp.web.lists.getByTitle("Test");
list.items.getById(bkRecordFKID).update({
Status: Status,
RequestFKID: "454" // hardcoded value
}).then(function () {
console.log("Updated!");
});
}
The issue is how can i access values in my form e.g
var RecordID = fd.field('RecordID').value in the fd.spSaved as i need these values to be updated in another list.
As i said in my original post i know i can get the itemId