URL formula button for 1st) saving a record and 2nd) direct to same record, different form.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

End of day ... and I am once again out of brain power and stumped!

I have a Survey that contains 3 forms for each record. Each form consists of unique questions that need to be completed by the survey respondent. They start with Form 1 and press a button when completed. The button directs them to Form 2 to complete. Same task when completing Form 2 to be directed to Form 3. When they are done with Form 3, the button should take the Respondent to a Thank You page.

Here is my URL Formula:

var text url =

URLRoot() & "db/" & Dbid() & 

"?a=er&rid=" & [Record ID#] & 


"javascript:DoSaveAdd() &\n$.get('" & 

$url & 


Appears to save the record correctly, however never directs the user to Form Id #12 for the next set of questions.

Is this even possible? Kirk Trachey says everything is possible with QB! So I am assuming the answer is yes and I just have to resign myself that I can't self teach myself this one and need your help badly as my CEO wants to see my work tomorrow.

Photo of Andrew


  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Ursula Ll

Ursula Ll

  • 1,634 Points 1k badge 2x thumb
Did you get an answer?
Photo of Jack

Jack, Champion

  • 50 Points
I think the issue that may be causing you problems is that the record ID does not exist until the record is saved. Redirecting to other forms is entirely possible providing you use the record ID or key field and you use rdr. If your user as part of completing form 1 is required to enter data into a child table this means the record id will exist for when you need it. If not then this can be quite tricky.
Photo of Jack

Jack, Champion

  • 50 Points
Here some code I normally use for submit buttons but I normally redirect to a dashboard, I've tweaked it slightly but as I'm typing this on an iPhone it may not be entirely correct.

You will need to specify the realm name and database id in the rdr section, app tokens in both sections and amend the fid (as I'm using this call to tick a checkbox).

Create a test Formula URL field and update the formula below (this is untested in the context above):

"javascript: if (confirm('Are you sure you want to submit this for approval?')) { window.open('"&URLRoot()&"/db/"&Dbid()&"?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=576dhgdfhhg5764&_fid_26=True&"&rdr="&URLEncode(URLEncode("https://REALMNAME.quickbase.com/db/DATABASEID?a=er&rid="&[Record ID#]&"&dfid=12"&
))&"&apptoken=576dhgdfhhg5764"&")','top=0,left=0,width=10,height=10,location=no,menubar=no,toolbar=no'); void('') } else { void('') };"
Photo of Andrew


  • 0 Points
Thanks Jack ... brain dead from working all day. I am getting up at 5 am to test this when I am bright eyed and bushy tailed! I'll let you know what I discover. Looks like a work around that works.
Photo of Jack

Jack, Champion

  • 50 Points

I've reviewed the code before work this morning, I have made some amendments to the code, it will work providing the record has already been created/saved, so may not work for your first form. It will not work from a user adding a new record as the record ID is not generated until the record is saved as I suspected and mentioned above.

See updated code:

"javascript: if (confirm('Are you sure you want to go to the next question?')) { window.open('"&URLRoot()&"/db/"&Dbid()&"?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=hugfjgsrg585445gsa&_fid_26=True&rdr="&URLEncode(URLEncode("https://REALMNAME.quickbase.com/db/b85hd7y6?a=er&rid="&[Record ID#]&"&dfid=12"
))&"&apptoken=hugfjgsrg585445gsa"&")','top=0,left=0,width=10,height=10,location=no,menubar=no,toolbar=no'); void('') } else { void('') };"

The only way I can think of to get around the issue is to create the records first. You could possibly do this by importing an excel spreadsheet with the users email address on it (you can hide this field on the form using a form rule) and then firing a notification email to each one of the users with their own direct link to edit (complete) the survey (they would then be editing a record rather than adding one). If you want to count respondents and not everyone will respond you could then have a status field that looks at whether the status for that individual is complete and filter out un-responded surveys.

Alternatively a highly theoretical possibility is below but this may be restricted to the same constraints as above:
Make your survey a parent table to a child record called record.
Then your button that takes the user to the form to complete the survey would need to use the api to add new parent record, tick a hidden box on the parent record then redirecting to, then add a new child record (ticking a box) and redirecting back to parent record in edit mode using the related parent record field which would contain the parents record ID, if this worked . If you removed the child records table and default created fields from the parent the user would not even know this was being done (except for a slightly slower loading). You would need to turn on automatically save parent record when adding a child record in the table settings also.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
You can use the Save and Scooby Doo technique to accomplish this. See my answer to my own question here:

What is the Save and Scooby Doo Technique?
All you would have to do is modify this one statement to include the dfid of you 2nd form:
document.location.href = gReqDBID + "?a=er&rid=" + rid;
To this:
document.location.href = gReqDBID + "?a=er&rid=" + rid + "&dfid=10";