Discussions

Expand all | Collapse all

How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

Krissy Krissy08-05-2015 02:05

Krissy Krissy08-05-2015 02:11

Krissy Krissy08-05-2015 02:26

QuickBaseCoach Dev./Training08-05-2015 14:04

QuickBaseCoach Dev./Training08-17-2015 19:24

Matthew Matthew08-17-2015 19:25

Paul Vorster07-13-2018 09:35

  • 1.  How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 02:05


  • 2.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 02:08
    This can be done natively except not the initial Save. You would need to be in View Mode having saved the record.


  • 3.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 02:11
    Okay I can work with that....


  • 4.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 02:17
    Actually sorry, I need to take that back.  The choices are either to push a button to put up an Add Record Form with some of the fields filled in and then user would do any additional data entry and save, or alternatively push a button to create the copied record and display it, but not be in edit mode.


  • 5.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 02:26
    Okay, let's try the first option.


  • 6.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 12:27
    There are two ways to go here. Low Tech and high Tech.

    Low Tech

    You will notice that when you use the More button while viewing a record and click to Copy this Record, the URL you see looks like this


    mycompany.quickbase.com/db/xxxxxx?a=GenCopyRecord&rid=770

    So the low tech solution is just to make a URL formula button to make that URL

    The formula would be

    URLroot() & "db/" & dbid() &  "?a=GenCopyRecord&rid=" & ToText([Record ID#])

    When you use that option by default all the data entry fields on the form will copy across to an Add Record Form.  If you do not want certain fields to Copy across then you individually go to each field that you do not want to copy across and uncheck the property

    Auto-fill Copy the value when using "Copy this Purchase Order" to add a new Purchase Order

    The best way to quickly get to the field Properties is to right click near the field on the form.

    The only downside of this method is that if any fields on the form are set to be Read Only or are not visible on the form, I don't think that they will copy across.

    Higher tech

    So the more reliable way would be to use an API

    Here is an example

    URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm"
    & "&_fid_12=" & [Purchase Order #]
    & "&_fid_42=" & URLEncode([Component or Bulk item?])
    & "&_fid_38=" & [Related Bulk item Master]
    & "&_fid_24=" & [Related Component]
    & "&_fid_28=" & ToText([Line Item Cost Override])
    & "&_fid_53=" & URLEncode([PO Line Comment])

    Note that when you use this method you are building a URL, and URLs may not have spaces or specials characters in them.  So where there might be a strong that you are putting into a field, which might have special characters or spaces you need to URLEncode as I have done above.  The "fid's" are the field ID numbers.

    Lastly, if you did decide that you wanted to actually create the record and display it to the user, then you could do this

    URLRoot() & "db/" & Dbid() & "?act=API_AddRecord"
    & "&_fid_12=" & [Purchase Order #]
    & "&_fid_42=" & URLEncode([Component or Bulk item?])
    & "&_fid_38=" & [Related Bulk item Master]
    & "&_fid_24=" & [Related Component]
    & "&_fid_28=" & ToText([Line Item Cost Override])
    & "&_fid_53=" & URLEncode([PO Line Comment])
    & "&disprec=1"


     




  • 7.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 06-24-2019 23:02
    Mark,

    I follow your Low Tech example above. Here is my question. Where do you actually add the formula? When I right click to get the field properties edit page I cannot locate a place where I would add this formula in. Thanks


  • 8.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 06-25-2019 00:36
    Montgomery,
    you would create a new field of type Formula URL and then put it on the form and set the form properties to show the field in View Mode.


  • 9.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 06-25-2019 00:40
    Thank you Mark. I'm curious, your title suggest you are a trainer. Do you offer one on one training packages by chance. I am finding the resources for QB very limited._


  • 10.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 06-25-2019 00:53
    I�d be happy to discuss the free Quick Base University training offerings and my �contact me when you are stuck� services. Yes I love to do training and act as a resource to keep you moving when you hit an obstacle.

    Contact me at www.QuickBaseCoach.com


  • 11.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 13:28
    Thank you!  I'm almost there..... I'm running into one problem.  I went with the high tech scenario option 1 - here is my formula:  

    URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm"
    & "&_fid_85=" & URLEncode([PO # (on PO form) - Lookup])
    & "&_fid_23=" & URLEncode([Item Number (on ITEMS form) - Lookup])
    & "&_fid_6=" & [Inspector]

    Field 23 is not populating.  It's a look up field that relates the inspection back to the item being inspected.  Any idea why that isn't populating?  FID 85 is also a look up field and that one is populating correctly.  Could it have something to do with the relationship between those 2 fields?


  • 12.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 13:35
    Glad you are getting close.  We will have you being an API whiz before you know it.

    You cannot populate a lookup field.  So what you need to find is the field [Related Parent] for where the lookup came from - ie the "reference field' on the right side of the relationship and populate that field.  Then ALL the lookups for that relationship will come down automatically.


  • 13.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 13:54
    I don't know about being a whiz but I'm atleast at novice level now! I found the correct reference field and it's now working. Thank you for your help!


  • 14.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-05-2015 14:04
    yay! Well done.


  • 15.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-17-2015 18:51
    Instead of copying the information to a new record, is it possible to copy data in specific fields to an entirely different form?


  • 16.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-17-2015 19:03
    Yes, you can click a record in one table and pop up an Add Record form in another table.  Just change the part of the formula which identifies the [_DBID_ of the table]


  • 17.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-17-2015 19:16
    So in the formula, the &"&_fid_6=" would be the field ID for the new record on form "B"? while the string next to it: & [Inspector] would be the field of the pre-existing record on form "A"?


  • 18.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-17-2015 19:24
    Exactly!


  • 19.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 08-17-2015 19:25
    I'll give it a shot, Thanks!


  • 20.  RE: How do I create a button on a form that will save the current record, copy some of the fields to a new record, and redisplay the new record in edit mode?

    Posted 07-13-2018 09:35
    Thank You Mark, great solution.