Can I create separate buttons to create records using the same form with different fields populated?

  • 0
  • 1
  • Question
  • Updated 12 months ago
  • Answered
We have several types of records that get created with the same form and are all in the same table.  So for example I want one button which says 'create new health record' which will have 10 fields pre-populated and another button which says 'create new financial record' which will have the same 10 fields pre-populated with different data ... etc with up to 10 or more 'create' buttons.  Thanks.
Photo of William

William

  • 70 Points

Posted 12 months ago

  • 0
  • 1
Photo of Chuck Grigsby

Chuck Grigsby

  • 1,978 Points 1k badge 2x thumb
If you look at the Add new child record button that gets generated on the child table after creating a table relationship you'll see the code it's using which basically create a new record in that child table and add the master tabls RecordID value to a numeric field in the child table. You can just copy/paste the &_fid_123="some value" and it will add that value to the field with ID of 123. Repeat for as many fields as you want to populate. then save all that code and make another button with the values for the health, then repeat for financial and so on. 

Personally I would script this and create a config object with the parameters of each button then javascript to handle the add record calls. Hope that helps. Good luck! Welcome to reach out directly if you need help. earn.com/chuck
Photo of Dan

Dan

  • 1,176 Points 1k badge 2x thumb
As a tip, I find it easier to manage these buttons when they're structured w/ one field per line, like so:
URLRoot() & "db/" & [_DBID_HERE] & "?a=API_GenAddRecordForm" &
"&_fid_23=" & URLEncode ([field value]) &
"&_fid_18=" & URLEncode ("value") &
"&z=" & Rurl()