I was given this task. There are 14 fields in a record, 7 fields have this years data, 7 have last years data. Each year, for numerous years, someone would export and dataload the current years data into the last years fields and a user would input the current years data in the current year fields. The fields are in a single double column section in a layout.

Now, they want the ability to add multiple rows for the current year fields in a table form going forward and also show last years values. They only need current and previous years, not more.

They want the ability to edit the current years data and just view the previous years data.

If I was clear in explaining this, how to set this up? VF is fine but explain how to store the data and how to display it.


  • I think you should store the 7 fields in a separate object, along with a field for the year and a master-detail field with the object that the fields are on now as a master. In that way you can record data for each year, without having to throw the old data out.
    – rael_kid
    Aug 10 '16 at 7:48
  • Won't there be an issue to creat a M/D realtionship if the master has records in it? Or is it only the detail that can not have any records?
    – Apex N-u-b
    Aug 10 '16 at 9:45
  • The detail object cannot have any records, so there won't be a problem.
    – rael_kid
    Aug 10 '16 at 9:52
  • Thanks. If you make it an official answer I can mark it.
    – Apex N-u-b
    Aug 10 '16 at 10:01

In this case it would be best to create a new object with the 7 fields on it. Alongside those 7 fields, create another field for the year and create a master detail relationship to the object on which the 14 fields currently are.

In this way, you will be able to log multiple years of data for each entity, without having to throw away data from previous years. The information for each year can be shown on the parent object's page layout as a related list, so the information will still be shown on the same screen.

If the requirement is only to be able to view previous values of the fields, maybe history tracking on the 7 fields would be enough. You could leave the fields like they are now, and just enable history tracking on them. In that way, every time a value gets changed, that change is logged. The entities history is shown as a related list, so the information will still be shown on the same page. However; the capabilities to report or otherwise perform logic on those history tracking records is far more limited than on the custom object as discussed above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.