Is there anyway of adding a custom query string parameter after clicking the Save & Close button?

  • 39
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I would like to add a customer query string parameter after clicking the Save & Close button.
For example, https://blank.quickbase.com/db/dbid?a=er&rid=1<b>&customeQueryStringParam=customValue</b>
I'm aware of how to do this with a custom button, but for this case, I would like to do this after clicking QuickBase's button.
Thanks in advance!
Photo of Samwise the Brave

Samwise the Brave

  • 152 Points 100 badge 2x thumb

Posted 11 months ago

  • 39
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,702 Points 50k badge 2x thumb
Matt, can you explain the purpose of this request, ie what are you trying to accomplish here?
Photo of Samwise the Brave

Samwise the Brave

  • 152 Points 100 badge 2x thumb
Thanks for the speedy response!
I'm trying to pass in which tab the user was on when they clicked the Save & Close button, so I could use some jquery to "click" them back to that tab after they have saved and they are back in view mode.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,234 Points 20k badge 2x thumb
You can include any query parameter you want in the URL so long as you do not conflict with  existing parameters - QuickBase will just ignore it. But you will have to arrange for script run in the page using an injection technique -  such as IOL -  that will read the URL parameter and synthesize a click on the appropriate tab. The relevant code to extract the query string parameter is this:

var urlParams = new URLSearchParams(window.location.search);
var customValue  = urlParams.get("customeQueryStringParam");
Photo of Samwise the Brave

Samwise the Brave

  • 152 Points 100 badge 2x thumb
Thank you for your response. I'm able to set and get the query string param when creating a custom button because adding the query string is as easy as adding it to the URL in the formula field.
The part I'm having trouble with is inside of my script (which is using the IOL technique), I'm unable to set a query string param that will show up in the URL once the page goes from Edit mode back to View (after clicking the Save & Close button).
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,234 Points 20k badge 2x thumb
Generally when you submit a page the server alone will control what page you redirect to so you have no control over that form of submission. However there is a crude form of redirection built into QuickBase forms that continues to work (I just manually tested it).

If you sent these two hidden fields as follows when the page submits you will save the record and redirect to ibm.com (replace with your URL):
$("input[name=RedirectURL]").val("http://www.ibm.com");
$("input[name=rl]").val("");
I don't often use this method as QuickBase could easily rework the form submission process and eventually they will. Try pasting the code into the console before putting it in a code page.
Photo of Samwise the Brave

Samwise the Brave

  • 152 Points 100 badge 2x thumb
Worked perfectly, thanks a lot!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 28,234 Points 20k badge 2x thumb
If it works that is the end of it so party on. However, you can probably accomplish the same result without passing custom query parameters. Just do everything in one single script and skip over the parameter passing.
Photo of Alex Wilkinson

Alex Wilkinson

  • 1,036 Points 1k badge 2x thumb
Another way to do this is to create a custom button "Save & same tab" which works like (and actually uses) the standard "Save & keep working" button except that it navigates back to the same tab. For details see this new post, which also includes a "Save & next tab" button.