Forum Discussion

Re: Button with Mailto link - Code stops working if & is in a field

Use URL Encode. These are my notes. I am not totally sure if it works with the Ampersand.

var text Subject = 
    "Enter Subject Line Text here " & [Add Fields If Desired] ;
 
var text File = URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e57/v0"; //use this if you want to include a file link

var text Body = 
     URLEncode("Enter text for body here")
    & "%0A%0A"                                                                                       //THIS IS A LINE BREAK PLUS SKIPS A LINE
    & URLEncode("Company Name: " & [Company Name]) // EXAMPLE OF HOW TO ENTER TEXT AND A FIELD
    & "%0D%0A"                                                                                      //THIS IS A LINE BREAK, DOES NOT SKIP A LINE
    & URLEncode("File Link: " & $File)
    & "%0A%0A"
    & URLEncode("QuickBase Link: " & [Field]));

var text Email = "mailto:ThisName@fakeemail.com" //WHAT EMAILS ARE IN THE TO LINE
& "?cc=ThisName@fakeemail.com"                                 //WHAT EMAILS ARE IN THE CC LINE
& "&subject=" & URLEncode($Subject)                             //NOTE: If you remove the cc line, then: & "?subject=" & URLEncode($Subject)       
& "&body=" & $Body;                                                                      // The first line after mail to should have a '?' and NO "&". This indicates everything following is being set.

  
"<a href="
 & $Email
 & ">" & "Create Email" & "</a>"

------------------------------
Mike Tamoush
------------------------------

1 Reply

  • MeaganN's avatar
    MeaganN
    Qrew Member
    URLEncode worked perfectly! Thanks for the help.

    ------------------------------
    Meagan Kellagher
    ------------------------------