Hi there! I'm trying to Update child list selected items field base on value in parent form.
I have a person field in parent form, something like "Assign to" and I would like to select one or more items in list control and populate their "assigned To" fields with value in parent form.
I try to mesh up in article "How to update metadata of uploaded documents in List or Library control" with what I found in " Add a new button to the left, which is hidden, if no item is selected" but I am not able to write a working code.
I think my ideas is correct but not my realization
new button
var button = {
text: 'Assegna',
class: 'btn-primary',
visible: false,
icon: 'Info',
iconType: 0,
click: function() {
var items = fd.control('Dispositivi').selectedItems;
items.forEach(function(item){
var selID = item.ID
//Filter list and get item id
pnp.sp.web.lists.getByTitle('Dispositivi UnipolMove').items.getAll().then(function(item) {
return item[selID].ID
var listID = item.ID
}).then(function(id) {
//update item
pnp.sp.web.lists.getByTitle('Dispositivi UnipolMove').items.getById(id).update({
AssegnatoA: fd.field('AssegnatoA').value
});
});
});
}
}