1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【GAS】フォームを使用したワークフロー

Last updated at Posted at 2020-04-17

フォームを使用した複数人の承認ワークフローを作りました。

function1~3にトリガーをそれぞれ設定
 →スプレッドシート編集時

チェックボックスにチェックを入れると、メッセージを送信し、二次認証者に…の繰り返しです。

スプレッドシート列の保護機能でアカウントを指定して、編集者のみ編集できるようにすることで他の権限のない人が触れないようにします。

フォームには既存の書式のエクセル・ワードなどの添付を必須にします。
あくまで、承認依頼の流れになりますが、。
 

        var ss = SpreadsheetApp.getActiveSpreadsheet(); //アクティブなスプレッドシートを取得
        var rng = ss.getActiveCell(); //アクティブセルを取得
        var flag = rng.getValue(); //アクティブセルのチェックボックスの値を取得 

       function myFunction1() {
 
        if(rng.getColumn() == 5 && flag == true){ //アクティブセルが5列で、チェックボックスにチェックを入れた(true)の場合 
     var result1 = Browser.msgBox('送信確認', '上長へ承認依頼を流しますか?', Browser.Buttons.OK_CANCEL);
     if(result1 == "ok"){
    GmailApp.sendEmail('example.com', 'Aさんより承認依頼がありました”', '新規承認依頼があります。ご確認お願い致します。')   }
     else {
    Browser.msgBox('”再確認”')}
     } 
     }

   
       function myfunction2() { 
    

     if(rng.getColumn() == 6 && flag == true){ //アクティブセルが6列で、チェックボックスにチェックを入れた(true)の場合    
      var result2 = Browser.msgBox('"送信確認"', '"上長へ承認依頼を流しますか?"', Browser.Buttons.OK_CANCEL);
      if(result2 == "ok"){
    GmailApp.sendEmail('example2.com', 'Cさんより承認依頼がありました', '新規承認依頼があります。ご確認お願い致します。')}
      else {
    Browser.msgBox('”再確認”')}
     }
    }

       function myfunction3() { 
     if(rng.getColumn() == 7 && flag == true){ //アクティブセルが7列で、チェックボックスにチェックを入れた(true)の場合    
      var result3 = Browser.msgBox('"送信確認"', '"上長へ承認依頼を流しますか?"', Browser.Buttons.OK_CANCEL);
      if(result3 == "ok"){
    GmailApp.sendEmail('example3.com', '”’Cさん’より承認依頼がありました”', '新規承認依頼があります。ご確認お願い致します。')}
      else {
    Browser.msgBox('”再確認”')}
     }
     }

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?