费用审批工作流程+层次结构审批

时间:2014-08-20 12:57:40

标签: javascript google-apps-script google-sheets workflow google-form

我正在努力扩展此处发布的工作流脚本:

James Ferreira Workflow video.


function sendEmail(e) {

var email = e.values[1];
var Item = e.values[2];
var cost = e.values[3];
var vendor = e.values[4]; 

var url = '<SPREADSHEET>';

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

  var html = "<body>"+
                "<h3>Please review</h3><br />"+
                  Item +": " + cost+ ": " + vendor+ "<br />"+ 
                "<a href="+ approve +">Approve</a><br />"+
                "<a href="+ reject +">Reject</a><br />"+
             "</body>";

  MailApp.sendEmail("<MY EMIAL>", "Approval Request", 
                    "What no html?", {htmlBody: html});  
}


function doGet(e){

  var answer = (e.parameter.approval == 'true') ? 'Buy it!' : 'Not this time, Keep saving'; 

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

  var app = UiApp.createApplication();
  app.add(app.createHTML('<h3>An email was sent to '+ e.parameter.reply + ' saying: '+ answer + '</h3>'))
  return app
}

问题1)如何根据成本构建额外的审批流程? 问题2)根据批准金额,我如何调整经理电子邮件?

例如:如果费用高于500英镑,我想将批准电子邮件发送给另一个电子邮件帐户/经理。如果脚本可以自动识别这一点,那将会很棒。

非常感谢对此的任何支持, 安德鲁

0 个答案:

没有答案