Forum Discussion
PrashantMaheshw
Qrew Captain
APIGods still are needed to resolve this, but some progress
I correct myself , I don't know how to achieve 4 as I've read at multiple place %%rid%% doesn't like to be URLEncoded in anyways,
var text rd="%%rid%%";
// Assuming you start from child record, This URL is to come back to the child and edit edit to enter parent id
var text urltwo=URLRoot()&"db/" &Dbid()& "?a=API_EditRecord"
//& "&_fid_8="&$rd --> This keeps failing as we cannot Record ID of parent , but works for any other field
& "&rid="&[Record ID#]
// This URL takes you to parent table and creates a new record, notice the dbid is hardcoded . The part which works
URLRoot()&"db/"&"bsguktwqs"&"?a=API_AddRecord"& "&_fid_6=Gobaby"
& "&rdr="&
// Next URL BEGINS to go child and edit
URLEncode($urltwo)
// Last URL with two encodes to come back to child ID after editing it back
& URLEncode("&rdr="&URLEncode(URLRoot() & "db/"&Dbid()& "?a=doredirect&z=" & Rurl()))
------------------------------
Prashant Maheshwari
------------------------------
I correct myself , I don't know how to achieve 4 as I've read at multiple place %%rid%% doesn't like to be URLEncoded in anyways,
- Below code creates a child
- Comes back to child , edits it . Please see notes with start with //
- Returns back to child record
- AppToken were disabled during my testing, you need to enable these
var text rd="%%rid%%";
// Assuming you start from child record, This URL is to come back to the child and edit edit to enter parent id
var text urltwo=URLRoot()&"db/" &Dbid()& "?a=API_EditRecord"
//& "&_fid_8="&$rd --> This keeps failing as we cannot Record ID of parent , but works for any other field
& "&rid="&[Record ID#]
// This URL takes you to parent table and creates a new record, notice the dbid is hardcoded . The part which works
URLRoot()&"db/"&"bsguktwqs"&"?a=API_AddRecord"& "&_fid_6=Gobaby"
& "&rdr="&
// Next URL BEGINS to go child and edit
URLEncode($urltwo)
// Last URL with two encodes to come back to child ID after editing it back
& URLEncode("&rdr="&URLEncode(URLRoot() & "db/"&Dbid()& "?a=doredirect&z=" & Rurl()))
------------------------------
Prashant Maheshwari
------------------------------
MarkShnier__You
3 years agoQrew Legend
I think there are two methods. @Prashant Maheshwari 's post reminded me of the %%rid%% technique.
If the goal is to Create a parent record with no data entry from the user, then you would use a regular API_AddRecord API (post back if you need help with that) and populate a field called [Record ID# of Originating Child] with the Record ID# of the Child record that you launched from.
Then create a Pipeline to trigger on Add Record where the [Record ID# of Originating Child] is >0 to edit the Child record for that Record ID# and put the Record ID# of the Trigger Added Parent record into the field for Related Parent.
There will be a bit of a delay while the Pipeline runs. If you needed a faster reaction time, I think that you could use an "old fashioned" webhook or Action to update the child record as they will trigger very fast.
.... now if your intent is to put up an AddRecord form and have the user fill in some fields and manually save, then you could have a simple Add Record API and once again populate a field in the Parent Record with the Record ID# of the Originating Child.
The initial Add Record API would just be this.
URLRoot() & "db/" & [_DBID_PARENT] & "?act=API_GenAddRecordForm"
& "&_fid_250=" & [Record ID#] // populating the field called [Record ID# of the Originating Child]
But then instead of having the user save normally, you would get the user to click a special formula Rich Text button with this code
var text RID = "%%rid%%";
var text EditChildToConnectToThisParent = URLRoot() & "db/" & [_DBID_CHILD]
& "?act=API_EditRecord&rid=" & [Record ID# of Originating Child]
& "&_fid_7=" & $RID;
var text DisplayNewParent = URLRoot() & "db/" & [_DBID_PARENT] & "?a=dr&rid=";
var text URL =
$EditChildToConnectToThisParent
& "&rdr=" & URLEncode($DisplayNewParent) & $RID;
"<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #4b7097; border-radius: 5px; color: #ffffff; display: inline-block; padding: 0px 0px 0px 0px; width:100px; text-align: center; text-shadow: none; border: 2px solid #030404; font-size: 12px \"href='"
& $URL
& "'>Display Parent with Child Attached</a>"
//NOTE: The %%RID%% does not seem to like being URLEncoded.
But a better suggestion is to launch from the Child with this code here.
URLRoot() & "db/" & [_DBID_PARENT] & "?act=API_GenAddRecordForm"
& "&_fid_250=" & [Record ID#]
& "&ifv=1"
.. what extra suffix will do that will do is take away the save button (along with all the header stuff) and force the user to save with the provided Rich Text Formula button.
The Rich Text formula button will land the user on the Newly created parent and the child will be attached in the Report link field with it displays.
You can, of course play with the parameters of the Rich Text button to control the size of the font and the colour of:
the button,
the words,
and the border.
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
If the goal is to Create a parent record with no data entry from the user, then you would use a regular API_AddRecord API (post back if you need help with that) and populate a field called [Record ID# of Originating Child] with the Record ID# of the Child record that you launched from.
Then create a Pipeline to trigger on Add Record where the [Record ID# of Originating Child] is >0 to edit the Child record for that Record ID# and put the Record ID# of the Trigger Added Parent record into the field for Related Parent.
There will be a bit of a delay while the Pipeline runs. If you needed a faster reaction time, I think that you could use an "old fashioned" webhook or Action to update the child record as they will trigger very fast.
.... now if your intent is to put up an AddRecord form and have the user fill in some fields and manually save, then you could have a simple Add Record API and once again populate a field in the Parent Record with the Record ID# of the Originating Child.
The initial Add Record API would just be this.
URLRoot() & "db/" & [_DBID_PARENT] & "?act=API_GenAddRecordForm"
& "&_fid_250=" & [Record ID#] // populating the field called [Record ID# of the Originating Child]
But then instead of having the user save normally, you would get the user to click a special formula Rich Text button with this code
var text RID = "%%rid%%";
var text EditChildToConnectToThisParent = URLRoot() & "db/" & [_DBID_CHILD]
& "?act=API_EditRecord&rid=" & [Record ID# of Originating Child]
& "&_fid_7=" & $RID;
var text DisplayNewParent = URLRoot() & "db/" & [_DBID_PARENT] & "?a=dr&rid=";
var text URL =
$EditChildToConnectToThisParent
& "&rdr=" & URLEncode($DisplayNewParent) & $RID;
"<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #4b7097; border-radius: 5px; color: #ffffff; display: inline-block; padding: 0px 0px 0px 0px; width:100px; text-align: center; text-shadow: none; border: 2px solid #030404; font-size: 12px \"href='"
& $URL
& "'>Display Parent with Child Attached</a>"
//NOTE: The %%RID%% does not seem to like being URLEncoded.
But a better suggestion is to launch from the Child with this code here.
URLRoot() & "db/" & [_DBID_PARENT] & "?act=API_GenAddRecordForm"
& "&_fid_250=" & [Record ID#]
& "&ifv=1"
.. what extra suffix will do that will do is take away the save button (along with all the header stuff) and force the user to save with the provided Rich Text Formula button.
The Rich Text formula button will land the user on the Newly created parent and the child will be attached in the Report link field with it displays.
You can, of course play with the parameters of the Rich Text button to control the size of the font and the colour of:
the button,
the words,
and the border.
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
- SamRettig3 years agoQrew MemberThank you very much Mark and Prashan! I will try the suggestions and let you know how it goes!Sent from my iPhone
- PrashantMaheshw3 years agoQrew Captain
HI @Mark Shnier,
You are right , action would work instantly. API_GenAddRecordForm and Richtext is a nice combination with IFV=1 , I will also try it out
I'm not aware how "old fashioned web hook" are to be used here ? Any help?
------------------------------
Prashant Maheshwari
------------------------------- MarkShnier__You3 years agoQrew LegendThe help text for web hooks is here. https://help.quickbase.com/user-assistance/configure_a_webhook.html
I'm not sure I can actually recommend using them in good conscious because there's a lot of syntax and they are more technical so future maintainability will require a developer who is a little more of a Technical Geek type :). They are also a bit obscure now, so if there was a problem and someone was trying to debug, unless there was clear documentation it may take someone a while to think to look to see if there are any webhooks.
Here is an example of editing a record from my own cheat notes.
ENDPOINT: https://mycompany.quickbase.com/db/xxxxxx
MESSAGEHEADER: QUICKBASE-ACTION
then the next box is the API like API_EditRecord
````````````````````````````````````````````````example of API_EditRecord
<qdbapi>
<usertoken>bxv4tx_bjix_8csgf2bk9xxxxxxxxxx</usertoken>
<rid>[Record ID#]</rid>
<field fid="14">[Next Contract Line Item #]</field>
</qdbapi>
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
- APIAdministrato2 years agoQrew Member
The %%rid%% and ifv=1 (so nicely explained here) work fine on the legacy form builder. But on the new one, I am encountering the following problem:
- The child record is built with the new form builder. The parent is also built with the new form builder. When I try to save the parent form, I get an unhelpful message that says "Record failed to save". This happens with or without ifv=1.
- Next I make just one change. The parent form is built on the legacy form-builder. Same fields and form. Just the old, legacy form builder. Now it all works perfectly, with or without ifv=1.
Any ideas on how to get this working with the new form builder for the parent?
------------------------------
API Administrator
------------------------------