我在下面有這個腳本,它通過電子郵件向這個人發送他們分配的所有未完成任務的副本。 但是,我希望它跳過主要專案狀態為“積壓”的所有任務 這是我當前的代碼,以及指向表副本的鏈接:
function sendEmails() {
// Retrieve Project IDs, Project names and Project Status
const project = sheetITPM.getRange("A2:J" sheetITPM.getLastRow()).getValues().map(r => ({ id: r[0], name: r[1], status: r[2]}));
//get Tasks Sheet and all rows needed
let s = '';
const sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("ITPM_Tasks");
const lastRow = sh.getLastRow();
const startRow = 2; // First row of data to process
const numRows = lastRow - 1; // Number of rows to process
const rg = sh.getRange(startRow, 3, numRows, 6);
const vs = rg.getValues();
let oners = {pA:[]};
//function to NOT include projects with status: "backlog"
//dont include tasks with status "Complete"
vs.forEach((r,i) => {
let [name,desc,status,owner,due] = r;
if(status != 'Complete') {
if(!oners.hasOwnProperty(owner)) {
oners[owner]=[];
oners[owner].push(r);
oners.pA.push(owner)
} else {
oners[owner].push(r);
}
}
});
//email subject and start message
let subject = 'IT Board - Weekly Reminder: The following tasks are assigned to you.';
oners.pA.forEach(p => {
let msg = `These Tasks below are assigned to you:\n`
//task array
oners[p].forEach((r,i) => {
let [name,desc,status,owner,due] = r;
msg = `Task - ${i 1}\n`;
msg = `Description: ${desc}\n`;
msg = `Due Date: ${due}\n\n`
});
msg = `notify the IT Project Management Team of any updates\n\nThank You`;
//send email to the task owner with their task array subject our message
MailApp.sendEmail(oners[p][0][3], subject, msg);
});
}
表格鏈接:
nl7k28t由于該專案仍處于待辦事項狀態,因此任務中的輸出顯示為 no 。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/408566.html
標籤:
