Skip to main content
Question

Copy Master detail records from a button based upon a selection on the form

  • March 24, 2024
  • 0 replies
  • 277 views

Forum|alt.badge.img+2

I am wanting to import or copy a set of master records from a template job(one of many so I need to be able to select before I push the button) , The selection being made on the jobs form. This process was working before they made code pages the only place you can run javascript code.  The formula i Used before is this

URLRoot() & "db/" & [_DBID_JOBS] & "?a=API_GenAddRecordForm&_fid_18=" & URLEncode ([Contact info ID#])& "&z=" & Rurl()

This code still works in another app but the 18383 is the reference to the Job that the detail records are to be copied from.  

I am having problems getting the code pages to even show up on the form as a button.

What am I doing wrong?



------------------------------
Loran Prince
------------------------------

This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+22
  • Quickbase Alumni
  • March 25, 2024

np,

The API you posted is the one that can be used to put up an Add Record form to duplicate a record that you are sitting on, but it will not copy Children.

I am going to assume that your template child records are from Template Parent records of the same table you are on.  ie you do not have a different tables for your templates, just the same tables for parent and children,  but some of the Parents are special template record., 

While there is an API to copy parents and children here's what I suggest you do for the best user experience.

Go to the settings for the application and then Application management and then locate the link to the wizard which will create a button for you.  Initially, just elect the option to copy the Children form the current Parent.

It will look like this

"javascript:void(copyMasterDetailButtonHandler('&copyFid=8&destrid=0&sourcerid=" & [Record ID#] & "', 'xxxxxxxxx'))"

Then edit it to look like this.

"javascript:void(copyMasterDetailButtonHandler('&copyFid=8&destrid=0&sourcerid="

& [Record ID# of the Parent template record] 

& "', 'xxxxxxxx'))"

In order to have a field for which Parent's template children to use [Record ID# of the Parent template record] , I suggest that you make a relationship of the Parent table to itself, so the user can select the Template parent.  The reason I suggest using this wizard which has permissible JavaScript, instead of the API format  is that it has a nice behaviour in that once it creates the new parent it offers the option to the user to land on the new parent which is typically what they want.



------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------