URL - Formula Field not executing all actions

  • 0
  • 1
  • Question
  • Updated 3 weeks ago
  • In Progress
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!
Photo of Jordan McAlister

Jordan McAlister

  • 302 Points 250 badge 2x thumb

Posted 3 weeks ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,582 Points 2k badge 2x thumb
I would try changing the order so the Edit happens first, then redirects the user back to the updated record; then launches the mail.
Photo of Jordan McAlister

Jordan McAlister

  • 302 Points 250 badge 2x thumb
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

----------------------------------------------------------------------------------
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,468 Points 50k badge 2x thumb
Try this syntax

$URLTWO 
& "&rdr=" & URLEncode($URLTHREE)
& URLEncode("&rdr=" & URLEncode($URLONE))
Photo of Jordan McAlister

Jordan McAlister

  • 302 Points 250 badge 2x thumb
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.
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,582 Points 2k badge 2x thumb
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.
(Edited)
Photo of Jordan McAlister

Jordan McAlister

  • 302 Points 250 badge 2x thumb
yea, I've tried a lot of different arrangements of those last 3 lines and couldn't get it to work.