Discussions

 View Only
  • 1.  Formulas in For Email Body Failing Mysteriously

    Posted 10-15-2020 23:09

    I use a Formula URL to generate an Outlook email.  In the body portion, I define various text variables up front, and then inline those as needed. 

    Everything was working just fine.  Then I decided to add a new text variable  (e.g. var text Mytext = "foo...") and include that text in the body as $Mytext &....,  and now it fails.  Specificaly, when I call the text then the email simply does not generate at all; in other words, clicking on the button in QB to generate the email does nothing.    I know the button formula for the mailto action works, along with the subject line portion. What fails is the body portion.  

    The text does not have any special characters.  I've tried multiple approaches.  First,  tried reducing the length of the text, and did find that there seems to be a limit around 360 chars.  Ok.  So I broke up the text into 2 sentences, each much shorter than that limit.  Call them MyTextA, MyTextB .   I can get MyTextA to work, but when then add a line to include MyTextB, the formula fails.    I note that the text vars are combinations of raw text and previously defined text vars, which in turn are based on the values in text fields in the database.

    Schematically this is what I'm doing:

    var text TextA = [field1];
    var text TextB = [field2]; 
    var text MyTextA = "foo" & $TextA & "more foo" & $TextB;
    var text $Letter="yaa dah yaa dah yaa had"; 
    var text $Final="blah blah blah";

    If([field3]="yes", $Letter, (If([field4]="yes", $Final & "%0D%0A" & "%0D%0A" & $MyTextA,$Final))) &"%0D%0A" & "%0D%0A" &

    The nested if statement works fine, and will correctly print either Letter, Final or {MyTextA and Final}, depending on the values of field3 and field4.    Now if I add $MyTextB like this:

    If([field3]="yes", $Letter, (If([field4]="yes", $Final & "%0D%0A" & "%0D%0A" & $MyTextA & MyTextB,$Final))) &"%0D%0A" & "%0D%0A" &

    or even simply put in line immediately after the if statement as

    $MyTextB &....

    then the formula button fails. Nothing, no email generated at all.   Remove the addition of $MyTextB, and everything works again.  

    Now with further testing I find this:  If I set MyTextB to 13 characters like "xxxxxxxxxxxxx" then it works.  But if I add a 14th character, the formula fails.    And only, I have more text that follows the above text blocks what works just fine.

    Thanks,





    ------------------------------
    ROBERT SACHS
    ------------------------------


  • 2.  RE: Formulas in For Email Body Failing Mysteriously

    Posted 10-16-2020 03:51
    Edited by Mark Shnier (Your Quickbase Coach) 10-16-2020 04:38
    The issue is that you are building a URL string.

    URLs should not have any spaces or special characters in them.  So any text which might have spaces or siecial characters needs to be URLEncoded.

    var text TextA =URLEncode( [field1]);


    do not URLEncode where you are using 

    &"%0D%0A" & "%0D%0A" &


    As that us already URLEncoded.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Formulas in For Email Body Failing Mysteriously

    Posted 10-16-2020 12:49
    Thanks, but that raises more questions. 
    The button to invoke the email is standard:

    "mailto:"&[Submitter.Email] &
    "?subject="&[Email.SubjectLine: CTS_Evaluation_Completed]&
    ""&"&body="&[Email.Body: CTS Evaluation Completed]&""

    The problematic component is body field.   I understand that this button is constructing a URL, using the computed result in the body field [Email.Body:CTS Evaluation Complete] .   

    I'm not using URLEncode in the body at all.  I'm constructing a large string of defined text blocks concatenated together, using formulas to determine which blocks to select. 

    Throughout, I use the &"%0D%0A" & "%0D%0A" & for paragraph returns, and it works just fine.    The problem arises when I simply add that one extra text block MyTextB.   Even if it just 14 chars of straight text, no spaces or special characters, then the entire thing fails. 

    Indeed, I just ran another text and setting MyTextB to "AAAAAAAAAAAAA" worked, but "AAAAAAAAAAAAAx" failed.  That was the only change made, adding "x", and bingo. Nothing.  

    I do use chars including : and / in the other texts but that does not cause any problems.  

    Still stumped...

    ------------------------------
    ROBERT SACHS
    ------------------------------



  • 4.  RE: Formulas in For Email Body Failing Mysteriously

    Posted 10-16-2020 13:28
    I would need to see your current formula which does not work.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Formulas in For Email Body Failing Mysteriously

    Posted 10-16-2020 14:52
    I'll send it to your gmail account.

    ------------------------------
    ROBERT SACHS
    ------------------------------