Forum Discussion

TroyTroy1's avatar
TroyTroy1
Qrew Trainee
8 years ago

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

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! 
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    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.
  • 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.
  • 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? 
  • 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.
  • 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. 
  • 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.
  • 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. 
  • 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.