Hi,
I am using below code to check if approval is pending for items in list or library control. If any item is pending approval then set the status field on the parent form to reviewed else change the status to pending. I see that the value of status field does change but it is not saved in the list. Any suggestions? Thanks as always.
//Check list or library before save
fd.spBeforeSave(() => {
fd.control('ListOrLibrary1')._widget.dataSource.read().then(function(){
var items = fd.control('ListOrLibrary1').widget.dataItems();
for (let i = 0; i < items.length; i++) {
//var obj = items[i].Approval
if (items[i].Approval == 'Pending'){
fd.field('Status').value = 'Pending';
return false;
}
}
fd.field('Status').value = 'Reviewed';
return true;
});
});