Need to create a button to copy the current record details and update a couple of field labels

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
I have a table called contracts and I want to create a button to copy all of the data in the current record and update some field labels upon copy. 
I have two fields that I would like to be updated when the record is copied. 
FY17 Totals and FY18 Totals. 
When the button is clicked. I would like it to copy the record and change the FY17 Totals field label to FY18 with the data currently in the field and the FY18 Totals field changed to FY19 and so on. Basically adding 1 to the last digit. 
Any help would be great! 
Photo of Troy

Troy

  • 110 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
A few of the native solutions include using the CopyMasterDetailsRecord wizard, but I'm not sure if it allows you to incrementally change the values.

Alternatively, you could use a button that utilizes the API_AddRecord.  
The tricky part is you would have to identify all the fields that need to be copied.  I'd imagine it wont be too many fields.

Post back if you get stuck.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
I think that you should rethink your approach.  Clicking a button to re-label fields is a very unusual thing to want to do.  Maybe if you describe your business situation, there is a better approach.
Photo of Troy

Troy

  • 110 Points 100 badge 2x thumb
Sure, I can try to explain more. The application is currently being used to capture and monitor Vendor contracts for my department. The record being used contains all the needed information a user would need to update or extend the contract for the current Fiscal Year. 
The ask is to be able to copy all the current contract information AND update/change the FY17 and FY18 fields labels to FY18 and FY19 on clicking a button. We are nearing the end of FY18 and users are starting contract talks for FY19 so I need to be able to easily update/copy the current contract record with no manual input or changing these fields. Does that help? 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
Wha t I suggest is to not use that approach.

There should be a contract and it should say what period it covers una data entry field.. The Labels in the fields would not refer to a specific year.

Then you can copy the record and change the year in a data entry field. To copy a record, you would use the More ... button to Copy This Record, or else we can help you make a button to do the same thing. Each field on the form has a field property checkbox which indicates if it should be copied when the record is copied. It defaults to yes, copy the field value to the new record.
Photo of Troy

Troy

  • 110 Points 100 badge 2x thumb
Hmm, I'am trying to minimize the amount of manual data entry for copying or updating these contract budget totals from year to year. We are currently using these fields to determine the increase or decrease from the previous contract to the current contract. 
So the FY17 Field represents the Total Cost for FY17 and the FY18 Total Cost shows what is the current spend. I have a formula field that determines the percent of increase or decrease from year to year. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
There are techniques for looking up data from 1 record to another. Would that help?

ie, relationship where the table is relayed to itself to be able to carry forward information to the next year.
Photo of Troy

Troy

  • 110 Points 100 badge 2x thumb
So I am still stuck on this. I am trying something different. I am trying to create a button that copies the current record and removes some data from only a few specific fields. 
Example would be: I have a contract that is expiring soon and all the information is in the current record. I need all the information in the current record to be copied except for the comments field, date fields to be cleared. The user will update when needed. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
You can make a formula URL button to either pop up an Add Record form  (using API_GenAddRecordForm )  with fields pre-populated or to actually create the record (using API_AddRecord )  with specific fields populated.