Google App脚本项目执行中的未知状态 [英] Unknown Status in Google App Script Project Executions

查看:111
本文介绍了Google App脚本项目执行中的未知状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Google表单,现场工作人员会填写并提交。随附的javascript通过电子邮件将表单内容作为电子邮件发送给办公室中的每个人。

I have an Google form that field crews fill out and submit. The attached javascript emails the contents of the form as emails to everyone in the office.

执行时间非常长。一个报告有19496秒,这时Gsuite应该在5分钟后自动终止任何脚本。有些在Google应用程序脚本执行日志中具有未知状态,并且为0秒。

The execution times are super long. One has 19496 reported seconds, when Gsuite should automatically terminate any script at 5 minutes. Some have "Unknown" status in the Google app script execution log and 0 seconds.

Gsuite配额是否用完了?我的脚本中有错误吗?

Is the Gsuite quota being used up? Is there an error in my script?

运行脚本触发器的用户也会收到回弹电子邮件,即使所有电子邮件都经过了处理,而Google工作表仍在通常会收到Google表单的回复。

The user running the script trigger also receives a bounce back email, even through all the emails are going through, and the Google sheet is receiving the response from the Google Form normally.

我尝试在顶部添加 if(e.values&&!e.values [1]){return;},并添加 return;。在底部。似乎并没有改变问题。

I tried adding "if(e.values && !e.values[1]){return;}" to the top and "return;" at the bottom. It didn't seem to change the issue.

我编辑了下面的google app脚本,以删除电子邮件地址的真实列表,并缩短了报告的时间。 Google表单的目的是提供他们过去工作的真实摘要,而不仅仅是在电子邮件中完成工作。因此,他们改为填写15个问题的列表。

I edited the google app script below to remove the real list of the email addresses, and shortened up the report. The purpose of the Google Form is to provide a real summary of their days work instead of just "Job is done" in an email. So, they fill out a list of 15 questions instead.

function myFunction(e){

// Set values for event "e" from Response form, each number being a column in the spreadsheet 
    var value1 = e.values[1];
    var value2 = e.values[2];
    var value3 = e.values[3];
    var value4 = e.values[4];
    var value5 = e.values[5];


  // Build subject and message for email that will be sent out
    var subject1 = value5 + " Job #" + value2 + " " + value3 + " Job Report Submitted " + value1 + "    -oOo-";
        var message_html = "<b>Date:</b> " + value1 + "<br>" + 
                   "<b>Job Number:</b> " + value2 + "<br>" +
                     "<b>Site Name:</b> " + value3 + "<br>" +
                     "<b>Client:</b> " + value4 + "<br>" +
                       "<b>Crew Chief:</b> " + value5 + "<br>";            


     // Send email to chief, of what the chief submitted through the Response form
     var chiefemail = "leo@email.com"; //setting leo email as the default - but this should not be used based on below 
     var chiefname  = "Leo E.";

     if (value5 == "Bryan N.") {
                                    chiefemail = "bryan@email.com";
                                    chiefname  = "Brian N";}
     else if (value5 == "Carl B.") {
                                    chiefemail = "carl@email.com";
                                    chiefname = "Carl B";
                                   }
     else if (value5 == "Clay W.") {
                                    chiefemail = "clay@email.com";
                                    chiefname = "Clay W";
                                     }
     else if (value5 == "Dakota P."){
                                    chiefemail = "dakota@email.com";
                                    chiefname = "Dakota P";
                                     }



 // Send emails to all office staff:     

   var EmailList = "brian@email.com," + chiefemail; 


       MailApp.sendEmail({
                          to: EmailList,
                          subject: subject1,
                          htmlBody: message_html,
                          name: chiefname,
                          replyTo: chiefemail
                           });


}

我想要脚本终止,并且我不想收到退回邮件。

I want the script to terminate, and I don't want to receive bounce back emails. Help!

推荐答案

我认为您可能会遇到我所说的虚假onFormSubmit触发器,我可能会尝试这样的操作。

I think it may be possible that your experiencing what I call spurious onFormSubmit triggers and I might try something like this.

function myFunction(e){
  if(e.values && e.values[1] && e.values[2] && e.values[3] && e.values[4] && e.values[5]) {
    var value1 = e.values[1];
    var value2 = e.values[2];
    var value3 = e.values[3];
    var value4 = e.values[4];
    var value5 = e.values[5];
    var subject1 = value5 + " Job #" + value2 + " " + value3 + " Job Report Submitted " + value1 + "    -oOo-";
    var message_html = "<b>Date:</b> " + value1 + "<br>" + 
      "<b>Job Number:</b> " + value2 + "<br>" +
        "<b>Site Name:</b> " + value3 + "<br>" +
          "<b>Client:</b> " + value4 + "<br>" +
            "<b>Crew Chief:</b> " + value5 + "<br>";            
    var chiefemail = "leo@email.com"; //setting leo email as the default - but this should not be used based on below 
    var chiefname  = "Leo E.";
    if (value5 == "Bryan N.") {
      chiefemail = "bryan@email.com";
      chiefname  = "Brian N";}
    else if (value5 == "Carl B.") {
      chiefemail = "carl@email.com";
      chiefname = "Carl B";
    }
    else if (value5 == "Clay W.") {
      chiefemail = "clay@email.com";
      chiefname = "Clay W";
    }
    else if (value5 == "Dakota P."){
      chiefemail = "dakota@email.com";
      chiefname = "Dakota P";
    }
    var EmailList = "brian@email.com," + chiefemail; 
    MailApp.sendEmail({
      to: EmailList,
      subject: subject1,
      htmlBody: message_html,
      name: chiefname,
      replyTo: chiefemail
    });
  }
}

您可以详细了解此处。您还可以检查堆栈驱动程序日志以查看发生了什么。

Your read more about it here. You can also check you stack driver log to see whats going on.

这篇关于Google App脚本项目执行中的未知状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆