it is getting me crazy, the code was working yesterday, but not anymore. I tried to check all syntax again, but the issue still persists. this server-side request from Google Sheets, shows value on server side (Logger.log()
), but returns null
in client side.
function supervisorLine(lineData) {
if (lineData == 'Name Value is not VALID!') {
console.log("Supervisor Name Issue!");
} else {
document.getElementById('Team').value = lineData[7];
document.getElementById('Shift').value = lineData[12];
document.getElementById('action').classList.remove("disabled");
console.log("team " + lineData[7] + " shift " + lineData[12]);
////////////////////////////////// need to be Moved somewhere after password check!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
google.script.run.withSuccessHandler(function(quickStat2) {
console.log(quickStat2)
}).loginRecords(lineData[7], lineData[12]);
}
}
this is my server side code as well:
function loginRecords(team, shift) {
var sh = ss.getSheetByName("Attn Rec");
var result = [];
var matchRec = sh.getRange("a2:l" + sh.getLastRow()).getValues().filter(function(a) {
return a[1] === shift && a[4].valueOf() == team.valueOf()
});
uniqeLogin = removeDups(matchRec.map(function(a) {
return a[9]
}));
// Logger.log(uniqeLogin);
uniqeLogin.forEach(function(a) {
var ary = [team, 0, shift, "", 0, 0, 0, 0, 0];
matchRec.forEach(function(r) {
if (r[9] === a) {
ary[1] = new Date(r[0]);
ary[3] = r[8];
switch (r[3].toString().toLowerCase()) {
case "off-site work":
case "hr action":
ary[8]++;
break;
case "present":
case "late transfer":
case "transfer":
ary[4]++;
break;
case "no show":
ary[5]++;
break;
case "Sick":
case "vacation":
ary[7]++;
break;
case "late":
case "approved delay start":
ary[6]++;
break;
}
}
});
result.push(ary);
});
Logger.log(result);
return result;
}
for recap, Logger.log(result)
returns the array I needed, but console.log(quickStat2)
returns null
.