Forum Discussion

AaronB's avatar
AaronB
Qrew Trainee
8 months ago

Page not refreshing after button click (+ record update, + popup page)

I want to:    Hit original button (formula URL field), update field ID #7 to now(), open splash page (as a popup), close splash page (via splash page button), return/refresh original page. 

Everything works except auto-refreshing the original page once the splash page/popup closes. 

I've tried conducting these activities in several different orders without success. 

Any help in getting me past that last hurdle will be appreciated......Aaron

-------------------------------------------------

Formula URL for the initiating button:

var text SplashPage = URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=12";
var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=<token>&rid=" &[Record ID#] & "&_fid_7=" & Now() & "&rdr=" & URLEncode($SplashPage)& "&rdr="&URLEncode($RefreshPage)

-------------------------------------------------

Splash Page  (html):

<h1><p><u>Your command has executed.</u></h1>

<button onclick="return closeWindow();">
    Close Window
</button>
 
<script type="text/javascript">
  window.resizeTo(950,500);
    function closeWindow() {
 
        // Open the new window with the URL replacing the
        // current page using the _self value
        let new_window = open(location, '_self');
 
        // Close this window
        new_window.close();
 
        return false;
       window.resizeTo(950,500);
    }
</script>



------------------------------
Aaron B
ab1692@att.com
------------------------------

9 Replies

  • I would convert the formula url to a formula rich text and do the following: 

    "<a class='Vibrant Success OpenAsPopup' data-height=950 data-width=500 data-refresh=true href=\""& $url &"\" >Button Label</a>"

    This will run your url and open whatever link you're targeting and then when you close the popup it will refresh the page for you. 



    ------------------------------
    Chayce Duncan
    ------------------------------
    • AaronB's avatar
      AaronB
      Qrew Trainee

      Chayce,

      I tried your solution but am getting the dreaded "404 Error, Page Unrecognized" popup when I hit the button.  I must not be integrating your solution correctly.  Here is my code for the formula rich text (button). 

      ---------------------------------------------------------------------------

      var text SplashPage = URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=12";
      var text URL = URLRoot() & "db" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] 
      & "&_fid_7="& Now() & "&rdr=" & URLEncode($SplashPage);

      "<a class='Vibrant Success OpenAsPopup' data-height=950 data-width=500 data-refresh=true href=\""& $URL &"\" >Hit Me</a>"



      ------------------------------
      Aaron B
      ab1692@att.com
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        That might be my fault, I must have copied something incorrectly as it's co-mingling ' and ". 

        Try it again as 

        var text SplashPage = URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=12";
        var text URL = URLRoot() & "db" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] 
        & "&_fid_7="& Now() & "&rdr=" & URLEncode($SplashPage);

        "<a class='Vibrant Success OpenAsPopup' data-height=950 data-width=500 data-refresh=true href='"& $URL &"' >Hit Me</a>"

        *the only change was to replace \" with ' around the $URL variable.



        ------------------------------
        Chayce Duncan
        ------------------------------