Skip navigation
Currently Being Moderated

Email button scripting

Jul 3, 2012 7:40 AM

I have a drop-down object (SupervisorList), a textfield (EmployeeEmail) and button object (SupervisorEmail). When the SupervisorEmail button is clicked, three things need to happen;

 

  1. The script needs to address an email message To the SupervisorList rawValue address
  2. Check to see if that address is one of three addresses (person1@company.com, person2@company.com or person3@company.com) and if yes, Cc: person4@company.com
  3. Also copy the EmployeeEmail address if not null.

 

 

I'm at a loss on how to accomplish this. This is my script:

 

Form1.Subform3.Approvals.Supervisor.SupervisorEmail::click - (JavaScript, client)

var vEmail;
var vSubject = "Vacation/Personal Leave Request";
var vBody = "Comments:"; 
var vCC;

if (EmployeeInfo.SupervisorList.rawValue !== null) {
     vEmail = EmployeeInfo.SupervisorList.rawValue;
}
if (this.rawValue == "person1@company.com" || this.rawValue == "person2@company.com" || this.rawValue == "person3@company.com"){
     "&cc" = "person4@company.com" + ";";
}
if (EmployeeInfo.EmployeeEmail.rawValue !== null){
     vCC = "&cc=" + EmployeeInfo.EmployeeEmail.rawValue;
}
else if (EmployeeInfo.EmployeeEmail.rawValue === null)  {
     vCC = "&cc=";
}
{
// Send email
event.target.submitForm({cURL:"mailto: " + vEmail + "?subject=" + vSubject + "&body=" + vBody + vCC,cSubmitAs:"PDF",cCharset:"utf-8"});
}

 
Replies
  • Currently Being Moderated
    Jul 3, 2012 9:17 AM   in reply to DKinsley

    Hi,

     

    I think you may have seen this example: http://assure.ly/dYQFb4.

     

    If you have a look you will see how I deal with the CC part of the script. You certainly have an error there at the moment.

     

    For example if the script is in the SupervisorEmail button, then it wont have a .rawValue. Therefore you need to refer to the dropdown AND not "this".

     

    Also when setting the vCC variable, you need this:

     

    var vCC = "";
    

     

    Then you could deal with declaring of the vCC:

     

    if (SupervisorList.rawValue == "person1@company.com" || SupervisorList.rawValue == "person2@company.com" || SupervisorList.rawValue == "person3@company.com") {
         vCC = "&cc" + "person4@company.com" + "; ";
    }
    
    if (EmployeeInfo.EmployeeEmail.rawValue !== null) {
         if (vCC == "") {
              vCC = "&cc=" + EmployeeInfo.EmployeeEmail.rawValue;
         }
         else {
              vCC = vCC + EmployeeInfo.EmployeeEmail.rawValue;
         }
    }
    

     

    Hope that helps,

     

    Niall

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points