簡體   English   中英

TypeError:無法從未定義中讀取屬性“ namedValues”。 (第9行,“代碼”文件)

[英]TypeError: Cannot read property “namedValues” from undefined. (line 9, file “Code”)

試圖找出我要去哪里。 我不是編碼人員,但正在重用我使用過的另一個Google工作表中的代碼。

我正在嘗試觸發填充此Google工作表的表單提交時發送的電子郵件。

這是公開的工作表: https : //docs.google.com/spreadsheets/d/1oV8bwS_o7O-Wu5LXoP-0e9M71NpbQy-a0ViTSZhXJPA/edit?usp=sharing

這是代碼:

function FormSubmit(formData) {
// Load the sheets for processing
var responseSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Master Editing Sheet");
var supData = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Support Data");
// Create and send the Email 
// Description is used to make the email
var description = supData.getRange(2,1).getValue();
var name = formData.namedValues["Prospects' Names"];

var timestamp = formData.namedValues["Timestamp"];

var to = "andrew.appel@gmail.com";
var subject = "New Prospect Submitted: " + name;
var message = "New Prospect | Submitted by | Initial Contact | Initial Notes: " + "\n" + "\n";
message += description + "\n" + "\n";
message += "The Master Recruitment Spreadsheet can be viewed by clicking on  the following link" + "\n";
message += "https://tinyurl.com/recruitmaster"
MailApp.sendEmail(to, subject, message);
}

非常感謝!! 安德魯

您傳遞給該函數的數據無效,因此無法調用其屬性。 基本上就像嘗試調用undefined.namedValues

您可能要檢查調用該函數的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM