5 Replies Latest reply on Sep 13, 2015 11:16 PM by try67

    Using an If/Else in conjunction with a 'app.mailmsg' ...

    danieln36912204

      I created a form for my work to basically create a fillable Work Order on my iPad. I have a button that when I push it, it automatically creates an email to a specific address and populates the Subject and Body with information pulled from my form fields. That works fine....

       

      What I am trying to do is create an If/Else condition where if the Business name is something specific one set of info will be pulled with added text fields, but if it is anything else it will run the standard script and pull the usual info... Here is what I have, I am not getting any error but it just will not use the conditions... It just keeps sticking to the original.

       

      // Setting field variables

      var subject1 = getField("Work Order / Call #").value;

      var subject2 = getField("Business Name").value;

      var client = getField("Client").value;

      var oldsn = getField("Removed SN 1").value;

      var newsn = getField("Installed SN 1").value;

      var timein = getField("Time In").value;

      var timeout = getField("Time Out").value;

      var travelmin = getField("Minutes").value;

      var travelkm = getField("KMs").value;

      var issue = getField("Issues List").value;

       

       

      //Email String

      if(this.getField("Business Name").value == "SPECIFIC BUSINESS") {

      app.mailMsg({

      cTo: "email@email.com",

      cCc: "email2@email.com",

      cBCC: "email3@email.com",

      cSubject: "Re: " + subject1 + " - " + subject2,

      cMsg: "Out: " + oldsn + "\nIn: " + newsn + "\nTime: " + timein + " - " + timeout + "\nTravel: " + travelmin + " and " + travelkm + "\nReplaced unit for " + issue + "\nSigned by "

      });

      }

      else{

      app.mailMsg({

      cTo: "email@email.com",

      cCc: "email2@email.com",

      cBCC: "email3@email.com",

      cSubject: "Re: " + subject1 + " - " + subject2,

      cMsg: "Out: " + oldsn + "\nIn: " + newsn + "\nTime: " + timein + " - " + timeout + "\nTravel: " + travelmin + " and " + travelkm + "\nReplaced unit for " + issue + "\nSigned by " + "\n-EXTRA INFORMATION"

      });

      }