Create a button that saves the current record and adds a new record to the same table

  • 0
  • 3
  • Question
  • Updated 7 months ago
  • In Progress
  • (Edited)
In this application users need to add multiple records containing some similar values. In order to prevent them from having to enter the same information again and again on each record they create, I would like to give them a button that:

1. saves the current new record AND
2. initiates the adding of a new record with the fields that contain repeated information already populated.

The native "Save and add new" functionality accomplishes #1 above, but not #2. When using this native functionality, the user still needs to enter ALL of the information manually.

So far I've created a button labeled "Save and add another" which works great (except for the annoying prompt to "Save" the record before moving on) when the user clicks it for each subsequent record they need to create.  The current record gets saved, and a new record is initiated with the repeated information auto-populating. Great! However, when they get to the last record and they use the native "Save and close" button, they get this nasty error:

"Record not found. It has probably been deleted. If you followed a link to get here, you may want to inform the author of that link that this record no longer exists." I'm not sure why this is happening.

Any thoughts on how to fix this?
Photo of Juan

Juan

  • 466 Points 250 badge 2x thumb
  • frustrated

Posted 1 year ago

  • 0
  • 3
Photo of Juan

Juan

  • 466 Points 250 badge 2x thumb
Well, I came up with an alternative solution to what I was looking for.

I created a separate button labeled "Save and Done." All this button does is (after prompting the user to save) open the last added record in view mode. 

Not ideal, but no nasty errors so I'll take it.

Now if I could only figure out how to add the code to save the record without that annoying prompt, that would make my day.

Cheers!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
The Native functionality under the More button to Add Similar, will carry forward any data from a a saved record in fields where the field property is checked to copy the value forward, which is the default behaviour.

The record, however, must be saved first.

If you want to make a URL formula button to replicate thus functionality so the users do not need to look for the More button you can use this Syntax.

URLRoot() & "db/" & dbid() & "?a=GenCopyRecord&rid=" & totext([Record ID#])
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
The same thing is happening to me, but I am not using the More Button. I am trying to add a child record, and for some reason, it will not allow me to save and then view the record. The "az=" takes me to a new record, and now this code (below) is generating the error described above. I don't understand, because I use it successfully on another form:

URLRoot() & "db/" & [_DBID_CUSTOMER_REPS] & "?a=API_GenAddRecordForm&_fid_26=" & ([Account #]) & "&dfid=10" & "&z=" & Rurl()

Despite the error, the record does safe with the child record.
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,746 Points 5k badge 2x thumb
Hi Kelly,

Is [Account #] field your key field in the parent table?

Thanks,

Gaurav
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Yes, it is.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
It is not clear what your question is and where this button code has been placed.


The suffix of & "&z=" & Rurl()


Causes the user to be returned to the Record they were on when they pushed the button.


If you want to stick on viewing the newly created record, remove that code.
(Edited)
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
I have a parent record and a child record. I want to Add a Child Record, and when I save it, I want to go back to the Parent Record in which I created it from. It works in another table. In this one, I am getting an error that says that it can't locate the record - despite the fact that it just saved both records. I don't know why it's going to this error page. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
Is the parent record saved when you hit the button?  Did you set the advanced properties of the Parent table to save automatically when a child record is created.

Advanced Table Settings

 Save parent record automatically when a child record is created. Learn more
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Yes, I did.
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Here are a couple screenshots to give you some perspective...

1. You can see that the Account is there. The parent record was saved.



2. You see that the Customer Rep was saved to the Parent Record. I have verified that these records do exist and are connected in the database. However, I still get this error...

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
Well that is a puzzler for sure.  I happen to be down in Boston at Quick Base right now for QSP meetings, so I can't engage with you one on one right now.  Maybe contact me off line via the info in my website QuickBaseCoach.com and I will set up a quick one on one at no cost to see what the problem could be.  Or else put in a support ticket to Quick Base Support.
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
My only theory is that this is a form that is open to everyone on the Internet. It is a parent record only. I have another form that is open to everyone on the Internet but made up of 2 child tables. Could that be it?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
Does it work if you remove the form override.

“&dfid=10"
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
No, but when I do that it doesn't acknowledge the parent relationship. The account name doesn't display.