复制自己的工作流程答案回复

时间:2016-05-20 16:26:17

标签: javascript

我正在创建一个工作流程脚本,除了一次打嗝外,效果很好。当批准者点击批准或拒绝时,我应该复制他们的答案。我尝试过几十种方法但仍然无法正常使用。请参阅以下代码:

function sendEmail(e) {
  var req = e.values[1];
  var reqfor = e.values[2];
  var reqforemail = e.values[3];
  var location = e.values[8];
  var reqbyemail = e.values[10];
  var director = e.values[13];
  var copyon = e.values[14];  

  var url = 'https://script.google.com/a/macros/ehdtech.com/s/AKfycbw1AqqDzH_sluzpbTo9ekbVX0e2k7E3Y-JNuD6IZuADvyzYRTTt/exec';

  var approve = url + '?approval=true'+'&reply='+reqbyemail;
  var reject = url + '?approval=false'+'&reply='+reqbyemail;


  var html = "<body>"+
                 "<h2>Please Review</h2><br />"+
                   "A computer or email address request form has been submitted by user: "+ reqbyemail+ "<br />"+
                     "For either an email address, computer or both indicated here: "+ req+ "<br />"+
                     "To be utilized at this locaton: "+ location+ "<br />"+
                     "The computer or email address will be issued to: "+ reqfor+ "<br />"+
                     "Their email address is or will be: "+reqforemail+ "<br />"+
                     "<a href="+ approve +">Approve</a><br />"+
                     "<a href="+ reject +">Reject</a><br />"+
                  "</body>";
 MailApp.sendEmail(director,"Approval Request",
                   "What no html?", {htmlBody: html});
}

  function doGet(e){ 

    var answer = (e.parameter.approval == 'true') ? 'Computer or email assignment approved. Your request is being fulfilled.' : 'This computer or email request has been rejected, for more information contact your director';


    MailApp.sendEmail(e.parameter.copyon, "Computer Request","","Your manager said: "+ answer);
    MailApp.sendEmail(e.parameter.reply,"Computer Request","","Your manager said: "+ answer);

    var app = UiApp.createApplication();
    app.add(app.createHTML('<h2>An email was sent to '+ e.parameter.reply + ' and jami.schmohe@ehdtech.com saying: '+ answer + '</h2>'))
    return app       
  }

col 1请求的内容, col 2接收计算机的新员工, col 3新员工电子邮件, col 8计算机所在的位置, col 10请求者的电子邮件地址, col 13电子邮件地址或主管, col 14我的电子邮件地址,

0 个答案:

没有答案