Hi Plumsail!
function populateDepartmentCodes(){
//specify your site URL
var siteURL = 'https://sitename.sharepoint.com/sites/Main/';
let web = new Web(siteURL);
web.lists.getByTitle('Department Codes').items.select('Title').get().then(function(items) {
fd.field('DropDown1').widget.setDataSource({
data: items.map(function(i) { return i.Title + ' plus added data ' })
});
//set the dropdown with the previously selected value
fd.field('DropDown1').value = fd.field('DepartmentCode').value;
});
}
fd.spRendered(function() {
//call function on from load
populateDepartmentCodes();
//fill SharePoint field with the selected value
fd.field('DropDown1').$on('change', function() {
fd.field('DepartmentCode').value = fd.field("DropDown1").value;
});
});
For this, is there a way where the data displayed is not going to be saved, bec as you can see, there is an added data to the dropdown and would not be exisitng in 'DepartmentCode' field?
fd.field('DropDown1').widget.setDataSource({
data: items.map(function(i) { return i.Title + ' plus added data ' })
});