Forum Discussion
QuickBaseJunkie
Qrew Legend
5 years agoHi Mike, I saw your similar question on my YouTube channel, thanks for subscribing!
You can use a code page with a button.
It's not quite clear what your workflow is, but this combo will create a new parent record, then open new child record with the parent pre-populated with a single button click.
The button could be located on a form (using a formula or plain URL field) or on a dashboard.
Formula URL field (the button):
URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=10" //replace the URLRoot & AppID if not using a formula
Code Page:
<html>
<head>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script>
$.get('https://mycompany.quickbase.com/db/parent_dbid?a=API_addrecord',function(data,success) {
var myrid = data.getElementsByTagName('rid')[0].innerHTML;
location.replace('https://mycompany.quickbase.com/db/child_dbid?a=API_GenAddRecordForm&_fid_12=' + myrid);
});
</script>
</head>
</html>
Let me know if this works for you 👍
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------
You can use a code page with a button.
It's not quite clear what your workflow is, but this combo will create a new parent record, then open new child record with the parent pre-populated with a single button click.
The button could be located on a form (using a formula or plain URL field) or on a dashboard.
Formula URL field (the button):
URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=10" //replace the URLRoot & AppID if not using a formula
Code Page:
<html>
<head>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script>
$.get('https://mycompany.quickbase.com/db/parent_dbid?a=API_addrecord',function(data,success) {
var myrid = data.getElementsByTagName('rid')[0].innerHTML;
location.replace('https://mycompany.quickbase.com/db/child_dbid?a=API_GenAddRecordForm&_fid_12=' + myrid);
});
</script>
</head>
</html>
Let me know if this works for you 👍
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------
- GabrielFigueroa5 years agoQrew MemberHello Sharon,
I am getting the below message.
The only difference was that instead of going to a Child record I wanted to stay (go to) the parent record just added.
------------------------------
Gabe Figueroa
Contractor
Miami FL
214-490-1719
------------------------------- QuickBaseJunkie5 years ago
Qrew Legend
@Gabe Figueroa Are you using a different key field from the record ID?
Try running a sample url through your browser, such as (https://mycompany.quickbase.com/db/parent_dbid?a=API_addrecord​)
You'll see something like this:
The "get inner HTML" for the 'rid' is referring to the <rid>X</rid>, so if you don't see that it could be the issue.
You may also need to add an apptoken if your app requires them.
------------------------------
Sharon Faust (QuickBaseJunkie.com)
Founder, Quick Base Junkie
https://quickbasejunkie.com
------------------------------- GabrielFigueroa5 years agoQrew MemberThank you, the issue was the apptoken. Honestly that had crossed my mind earlier but got distracted.
The function works but it is adding a blank record &redirecting me to that record and not the one I intended.
If I were to subtract 1 from the myrid then I would land on the record desired but the blank records would still get created.
------------------------------
Gabe Figueroa
Miami FL
214-490-1719
------------------------------