0

We have a Custom Object Meter Reading that has three fields:

  1. Old Value
  2. New Value
  3. Difference (formula field)

We are creating records that display the difference between the old and new values of Meter Readings. Each record´s Old Value should be the previous record´s New Value, without entering it in manually.

We want the Old Value field to be auto-populated with the New Value field of the previous created record.

What is the most efficient way to achieve this?

1

I would think creating a button and using the URL field population method would work well in this scenario.

Check out this link, it's a pretty detailed guide on how to do it.

link

In your scenario where you want to populate a new record with values of the previous record, we'll need to have the old records values on the master record.

We could do this two ways:

  1. Use a workflow rule on the child object to update custom field(s) on the master record i.e. 'Last Meter Reading Value'.
  2. Use a rollup summary filter to find the value of the latest child object record - I'm not sure offhand if this is possible with rollup summary fields, so that's why I've included the workflow option.

Then use the 'Last Meter Reading Value' on the master record to prepopulate the 'Old Value' field on the new child object record using the URL population method outlined above.

This is assuming you have a data model along the lines of:

Object: Master Object (Account? Contact? Meter? Other?)
Field: Last Meter Reading Value

Object: Child Object (Meter Reading)
Field: Old Value
Field: New Value
Field: Difference (Formula: New Value - Old Value)

The process would be something like:

1. Master Object record 'Meter 1' is created. - Last Meter Reading Value = 0.

2. Meter Reading record 'Meter Reading 1' is created. - Old Value is 0. - New Value is 12.

3. Workflow rule fires on creation of 'Meter Reading 1'. - Field update: Updates 'Meter 1: Last Meter Reading Value' with the value of 'Meter Reading 1: New Value' (12).

4. Meter Reading record 'Meter Reading 2' is created. - Old Value is 12 (pre-populated from the value of 'Meter 1: Last Meter Reading Value'). - New Value is 36.

5. Workflow rule fires on creation of 'Meter Reading 2'. - Field update: Updates 'Meter 1: Last Meter Reading Value' with the value of 'Meter Reading 2: New Value' (36).

Steps 4 & 5 are repeated for each new Meter Reading record.

8
  • Thanks for your answer, but i feel like it doesn´t answer my question. The link you posted makes it possible to auto-populate fields with the values of the master. I am looking for values of an older record in the same object. – dnbrobin Aug 29 '14 at 10:22
  • Have added a bit more background to outline how it could work. – Davin Casey Aug 29 '14 at 10:26
  • Thanks for your quick reply. I still dont understand. A rollup summary is not an option, because we work within one object. The workflow rule cannot update a field with the value of the previous record. I dont quite get how i can reference the previous record. – dnbrobin Aug 29 '14 at 10:47
  • 1
    OK I've updated my post again with data model outline & step by step explanation of how the process works. – Davin Casey Aug 29 '14 at 11:00
  • 1
    It sounds like you have a Lookup field on Meter Reading looking up to Meter? Cross object workflow field updates require a Master-Detail relationship unfortunately, so you'll need to change that field. – Davin Casey Aug 29 '14 at 12:44

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.