i have been trying a few different things but cant get it to work. please see my code below.
function compareNameToCurrentUser(){
pnp.sp.web.currentUser.get().then(function(user){
compareNameToUser(user.LoginName);
getUserProvince(user.LoginName);
});//pnp.sp.web.currentUser
}//compareNameToCurrentUser()
function getUserProvince(name){
var filter = "Empl/Name eq '" + name.replace('#', '%23') + "' and YearforPlumsail eq '" + new Date().getFullYear() + "'";
pnp.sp.web.lists.getByTitle("PTO-Admin").items.filter(filter).get().then(function(items){
return items[0].Province
}).then(function(Province){
pnp.sp.web.lists.getByTitle('Holidays').items.filter('Province eq ' + Province).get().then(function(dates){
//code to diable dates
//trying to see if the province is being returned.
fd.field('TestDays').value = items[0].Province;
})
});
}
fd.spRendered(function () {
//Employee Balances and name check
compareNameToCurrentUser();
getUserProvince(value.Key);
});
That function help me get the current login In user.
Then it compares and the name and current year with data from another list and gets data. Then I assign it to some of the fields.
Nikita helped me with that. I can send it to you if you like.