簡體   English   中英

Google Apps腳本google.script.run.withSuccessHandler失敗

[英]Google Apps Script google.script.run.withSuccessHandler failing

我有2個google.script.run.withSuccessHandler調用一個接一個地發生,當我嘗試將兩者結合起來時,它不起作用。 這是有效的代碼,包含受影響的所有主要內容。

//These are in a javascript function which executes when a submit button is clicked.
google.script.run.withSuccessHandler(updateOutput).processForm(frmData);
google.script.run.withSuccessHandler(returnMessage).sendEmail(theData, titles);

//server functions
function processForm(theForm) {
  try{
    var fileBlob1 = theForm.resumeFile;

    var fldrSssn = DriveApp.getFolderById('My Folder ID');
    fldrSssn.createFile(fileBlob1);

    return 'good';
  }catch(e) {

  }//End catch
}

function sendEmail(arr, titles) {
  try {
         //This function sends an email and edits a spreadsheet. Nothing is affected
       return 'Request Submitted';
  }
}

但是當我嘗試將兩者結合使用時,程序會識別出已單擊提交按鈕,但它不會超過google.script.run.withSuccessHandler命令。

//google.script.run.withSuccessHandler(updateOutput).processForm(frmData);
google.script.run.withSuccessHandler(returnMessage).sendEmail(theData, titles, frmData);



function sendEmail(arr, titles, theForm) {
  try {

    //Uploads the files
    var fileBlob1 = theForm.resumeFile;

    var fldrSssn = DriveApp.getFolderById('My Folder ID');
    fldrSssn.createFile(fileBlob1);
    var url1;
    //Contains the rest of the code for sending an email and editing a spreadsheet.


    return 'Request Submitted';
  }
}

這不起作用。 有誰知道為什么會失敗? 第一個函數成功時調用的函數都只顯示一個彈出窗口,告訴用戶他們的響應已提交。

來自Google文檔:

頁面中的表單元素也是合法的參數,但它必須是函數的唯一參數。

您不能使用表單元素傳遞任何其他內容,它必須是唯一的參數。

Google文檔 - google.script.run.function(參數)

暫無
暫無

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

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