Forum Discussion

Re: Formula URL button - save and redirect

That is helpful, thanks! Is there a way to have the action pause in between when the record saves and the next page displays? I have a pipeline that runs when the record is saved, and I want that to be finished before displaying the next page. I tried looking at the examples on Code Pages App, but the examples are either Prompt & Redirect, or Run, Pause & Refresh. I would need something like Save, Pause & Redirect. I don't know javascript really at all to be able to figure out what needs to be changed.

------------------------------
Brittany Scheid
Special Projects Manager
SimiTree
------------------------------

6 Replies

  • QuickBaseJunkie's avatar
    QuickBaseJunkie
    Icon for Qrew Legend rankQrew Legend
    @Brittany Scheid, you should be able to use the Run, Pause, & Redirect.

    Only in place of an API call for the 'run', navigate to say the home page (anything away from the page you're on).

    So taking the formula from the app you mentioned...

    / Creating a toggle for the Checkbox
    var text toggle = If([Checkbox 2], "false", "true");

    // API URL to Add/Edit/etc.
    var text urlToExecute = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken=" & [App Token]
        & "&rid=" & [Record ID#] & "&_fid_20=" & $toggle;

    URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=6" // Open code page 6
    & "&url=" & URLEncode($urlToExecute) // Pass in the URL to execute

    Change the urlToExecute variable to URLRoot() & "db/" & AppID()

    -Sharon​

    ------------------------------
    Quick Base Junkie
    Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------
    • BrittanyScheid's avatar
      BrittanyScheid
      Qrew Cadet
      Thank Sharon. I tried this, but it's still just sending me back to the same page after it goes to the code page. I tried sending it to the form that I want and also just to the app home page and neither worked. Both times it just went back to the same edit form screen.  Any thoughts? Below is the code from the formula-URL field.  I used the code directly from the code page Body on this page without any changes.

      var text rid = 
          If([Record ID#]>0,
              ToText([Record ID#]), // Record ID already exists
              "%%rid%%" // New record, no Record ID exists yet
          )
      ;
      
      // API URL to Add/Edit/etc.
      var text urlToExecute = URLRoot() & "db/" & Dbid() & "?a=er&dfid=12&rid=" & $rid;
      
      //& Dbid() & "?a=er&dfid=12&rid=" & $rid;
      
      URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=4" // Open code page 4
      & "&url=" & urlencode($urlToExecute) // Pass in the URL to execute​


      ------------------------------
      Brittany Scheid
      Special Projects Manager
      SimiTree
      ------------------------------
      • QuickBaseJunkie's avatar
        QuickBaseJunkie
        Icon for Qrew Legend rankQrew Legend
        @Brittany Scheid Ahhhh, I missed that in my last reply.​

        On the code page, update this line of text:

        window.location.href = document.referrer;

        to

        window.location.href = document.referrer + '&dfid=12';

        assuming your form id is 12

        Please note, this will render the code page less versatile for multiple uses since it will be hard coded to return to this specific form. But this is the simplest way to achive your goal.

        -Sharon

        ------------------------------
        Quick Base Junkie
        Quick Base Junkie
        https://quickbasejunkie.com
        ------------------------------