vendredi 21 mai 2021

Google apps script - If function logic & URL

How can I add the "radiobutton" so that it is after the if statement - when I originally tried to do it - it created two forms?

Also how can I capture the URL of the form that is created so that I can send it to the approver of the sheet in MailApp.sendEmail?

if (period == 'Yes'){
  
      var form = FormApp.create("Request for Leave" + UID)  
          .setTitle(name + " REQUEST FOR LEAVE" )
          .setDescription("LEAVE DATES REQUESTED; \n\n"  + date_from + " to " + date_to + "\n\nTYPE OF LEAVE; \n\n" + paid + " " + leave_type + "\n\nREASON FOR THE REQUEST; \n\n " + info + "\n\nCOVER HAS BEEN ARRANGED BY \n\n" + cover +"\n"  );
      
      // radiobuttons  
      item = "Leave approved?";
          var choices = ["YES", "NO",];  
      form.addMultipleChoiceItem()  
          .setTitle(item)  
          .setChoiceValues(choices)  
          .setRequired(true); 
        }
  
  /**Following is for part of day */

    { var form = FormApp.create("Request for Leave" + UID)  
          .setTitle(name + " PARTIAL DAY REQUEST FOR LEAVE" )
          .setDescription("LEAVE DATE REQUESTED; \n\n"  + date_from  + " between " + time_from + " and " + time_to + "\n\nTYPE OF LEAVE; \n\n" + paid + " " + leave_type + "\n\nREASON FOR THE REQUEST; \n\n " + info + "\n\nCOVER HAS BEEN ARRANGED BY \n\n" + cover +"\n"  );
      
      // radiobuttons  
      item = "Leave approved?";
          var choices = ["YES", "NO",];  
      form.addMultipleChoiceItem()  
          .setTitle(item)  
          .setChoiceValues(choices)  
          .setRequired(true); 

Aucun commentaire:

Enregistrer un commentaire