can I use api GenAddRecordForm and at the same time add a record link?

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered
the URL button is : URLRoot() & "db/" & [_DBID_CLIENT] & "?a=API_GenAddRecordForm&_fid_125=" & URLEncode ([Record ID#])& "&z="

however because fid_125 is a link and not a lookup, it doesnt add the link to the recordID ...
I have two tables (P)rojects (_DBID_CLIENT) & (W)orkorders (_DBID_TABLE_1), where 1P record can have nW records or a 1:n relationship.

I added the URL button (with the above URL) in hopes that the Workorder would get added to the details of the newly created Project record ... it doesn't ... and I understand why .. but I don't know how to fix it.  I need the URL button to do the following when its clicked

1. Invoke the API_GenAddRecordForm on [_DBID_CLIENT]
2. Take the new Record ID# created in step 1, and set the Numeric Ref (fid_28) in [_DBID_TABLE_1] to its value

it seems simple but I'm just not sure how to do it...
Photo of Steven

Steven

  • 10 Points

Posted 5 years ago

  • 0
  • 1
I'm confused. At the point that you are clicking this button, does the Parent project record exist yet?
Then in 2. above, you talk about setting the numeric reference field ID 28 to "its value"  what is "its value" - who is it?

Then you also say that fid 125 is a "link:"  what do you mean by that.  What is the field ID for the reference field on the right side of the relationships between 1 project has many workorders.

.. and just to be clear, are you just trying to add a workorder to an existing project, or are you trying to create a project and a workorder at the same "save".
Photo of Steven

Steven

  • 10 Points
I'm confused. At the point that you are clicking this button, does the Parent project record exist yet? **No**
Then in 2. above, you talk about setting the numeric reference field ID 28 to "its value"  what is "its value" - who is it? **fid_28 is the field that was created as a Link field in the Workorders table when I created the relationship.**

Then you also say that fid 125 is a "link:"  what do you mean by that.**in this case 125 is the Link field created in the Project Table**  What is the field ID for the reference field on the right side of the relationships between 1 project has many workorders. **fid_28**

.. and just to be clear, are you just trying to add a workorder to an existing project, or are you trying to create a project and a workorder at the same "save". **I'm trying to add a workorder to a new project**
The only way to add children and a parent at thew same time is to enter the child record(s) into a grid edit form on the parent record.  When you save a new project and new children at the same time in that manner, QuickBase is smart enough to first save the parent, and then save the children and attach them.

Other than that, there is no way in native QuickBase to create a parent and create children in one click.

I am also still confused at that formula referring to fid 125.  if the reference field on the right side of the relationship to connect the child to the parent is fid 28, then that is the field which needs to be populated with the value of the record ID of the parent.
... do you have a report link field on your parent record and have you set it to show the child record on the form and have yoou set it to be "editable" in field properties - that is how you enter children onto a parent record in grid edit mode.
Photo of Eric

Eric

  • 40 Points
When adding a record using API_GenAddRecordForm, the newly created record doesn't have an ID yet to use in a subsequent API call. You could however have a second button that is on the view form they could press that would take the second action. It would require them to manually press this additional button but should solve what you described here.

If these details don't answer your question, I suggest creating a new support case by clicking Help->Manage My Support Cases while logged in to QuickBase. One of our team members can take a look at your application with you, and suggest a solution to this question then.