Forum Discussion

JordanMcAlister's avatar
JordanMcAlister
Qrew Captain
7 years ago

URL - Formula Field not executing all actions

Hi,

I am having issues with my URL Formula field not executing all my actions. If I comment out either one, it works, but it seems as though when it executes one action, the rest get ignored. Also, I am not great with coding, so I may have a really simple theory or format mistake. Basically, I have a button and I need it to send an email with a download link from the "Sketch" or "Updated Sketch" field to a specific user for approval while also updating the "Sent for Approval" field with the current date.

Currently, I can do one or the other depending on which command I comment out, but not both; if none are commented out, it just executes the first command. So, is there a way to execute this all at once? Or perhaps a better way?

Other Parameters:
-My key field is [WR #]
-[WR #] -> fid = 10
-[Sketch] -> fid = 71
-[Updated Sketch] -> fid = 91

Here is my code:
-------------------------------------------------------------------------------------
var text URLONE = "MailTo:someone@someplace.com"
//&"?cc=user2@domain.com; user3@domain.com; user4@domain.com"
&"&subject=WR for Approval"
&"&body=WR "&[WR #] &" is ready for approval."&"%0A%0A" &"Below is the download link for the sketch:" & "%0A" & 
If(
[Updated Sketch]="",
"https://pike.quickbase.com/up/"; & Dbid() & "/a/r" & [Record ID#] & "/e71/v0",
"https://pike.quickbase.com/up/"; & Dbid() & "/a/r" & [Record ID#] & "/e91/v0"

);


var text URLTWO = "https://pike.quickbase.com/db/bmwn5ta2x";

& "?a=API_EditRecord&key=" & [WR #]

& "&_fid_50=" & ToText(Today()) & "&apptoken=myapptoken";

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$URLONE
&
$URLTWO
&
"&rdr=" & URLEncode($URLTHREE)
-------------------------------------------------------------------------------------

All help is appreciated!
  • I would try changing the order so the Edit happens first, then redirects the user back to the updated record; then launches the mail.
  • I tried switching and it changes the record I need and refreshes the page, but then doesn't launch the email.

    Here is the bottom part of the edited code:
    ----------------------------------------------------------------------------------

    $URLTWO
    &
    "&rdr=" & URLEncode($URLTHREE)

    $URLONE

    ----------------------------------------------------------------------------------
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Try this syntax

      $URLTWO 
      & "&rdr=" & URLEncode($URLTHREE)
      & URLEncode("&rdr=" & URLEncode($URLONE))
    • JordanMcAlister's avatar
      JordanMcAlister
      Qrew Captain
      Almost there! This format updates the record and brings up the email, but the page redirect ends up being blank. If I hit the back button to load the previous page, it shows the record with the change I needed.
    • LauraThacker's avatar
      LauraThacker
      Qrew Captain
      Yes - I have been getting the same problem.  Technically what you want is the MailTo to open in a separate window; but I cannot get this to work natively myself from a single button.  The problem with having to use the back-button is that this is not user-intuitive behavior and so it would probably be smarter to get some more technical support to make this a user-friendly feature.

      Alternatively, use a 2-button process.  One button to edit/redirect and a second to launch the MailTo.  If you do figure it out; I would love to see the solution.