Forum Discussion

ToddM's avatar
ToddM
Qrew Cadet
8 years ago

URL Button to Open New Window

I have a formula URL button that when pressed, creates a child record and refreshes the record, however I need it to then open a new window. Here's what I have thus far:

            var text URL = URLRoot() & "db/XXX?act=API_AddRecord" & "&apptoken=XXX"& "&_fid_14="  & URLEncode ([Record ID#])
                         & "_&_fid_16=" & URLEncode ([Current User Name])
                         & "_&_fid_17=" & URLEncode ([Current User Email])
                         & "_&_fid_6=" & URLEncode (Now());

"javascript:" &
"$.get('" & 
$URL & 
"',() => location.reload(true));"


Going nuts here trying to figure this out for a client. Any help or input would be greatly appreciated and worthy of a Christmas card for life. If I'm unclear, just ask me and I'll answer any questions you have. Thanks!!! 
    • ToddM's avatar
      ToddM
      Qrew Cadet
      Thanks for the quick reply!! 
      The child record is created and then the User should be automatically redirected to the refreshed parent record in a new window.
    • ToddM's avatar
      ToddM
      Qrew Cadet
      Opening target in new window will not work in this case because of the injected Java script. Thanks though!! 
  • This will create the child and if you click the box a box that Matthew indicated above, the child will display in a new window.

    URLRoot() & "db/XXX?act=API_AddRecord" & "&apptoken=XXX"& "&_fid_14="  & URLEncode ([Record ID#])
     & "_&_fid_16=" & URLEncode ([Current User Name])
     & "_&_fid_17=" & URLEncode ([Current User Email])
     & "_&_fid_6=" & URLEncode (Now())
    & "&disprec=1
    • ToddM's avatar
      ToddM
      Qrew Cadet
      Box is checked and I tried the code, however it didn't open in a new window
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Are you trying to display the child in the new window or the parent.
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Note that in my post above, it is just that code, not the javascript stuff. Don't include the javascript.
  • var text URLONE =
    URLRoot() & "db/XXX?act=API_AddRecord" & "&apptoken=XXX"& "&_fid_14="  & URLEncode ([Record ID#])
     & "_&_fid_16=" & URLEncode ([Current User Name])
     & "_&_fid_17=" & URLEncode ([Current User Email])
     & "_&_fid_6=" & URLEncode (Now());


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

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


    .... and set that  checkbox to open in a new window.
  • Well, what can I say! You da man!! It worked! Can't tell you how thankful I am for you helping so quickly. I didn't know I could do a redirect after adding a record. I thought it had to be saved. 
    Looking forward to getting some sleep now. Thanks again! 
  • The first night of Chanukah is December 12th.  I will watch my mail for my card.  

    as for redirects, I have an app in the exchange called URL formuals for dummies.  You can do a lot of nested redirects.


    $URLONE 
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))
    & URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
    & URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLFIVE))))
    & URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSIX)))))
    & URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSEVEN))))))

    The very last one needs to display a record or report so the user does not see the XML success message, which is not user friendly.