function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sonia GenesseSonia Genesse 

Is there a way to loop through records in a single object and compare two fields and create a report with the results in a formula field?

Good evening,

I'm looking to report on mutiple failures where a serial number appairs more than once in the SAME Object but in different records.

Currently, the report I have will show ALL failures within the last year whether or not the part failed once or mutiple times.

The example below illistrates the highlighted items that I want to show up on the report, their is only one item that doesn't have a mutiple failure (dated 7/25/2018 4th up from the bottom).

There are two fields: New Parts Serial Number and Defect Serial Number, we could have a Part being in the New Part column during one service and then it fails, and would now be in a new record in the Defect Part column..
 
User-added image

Could this perhaps be achieved using a Flow or Formula field on the same object?  **Note this is a custom object**

Thanks in advance!
Sonia
Waqar Hussain SFWaqar Hussain SF
Hi Sonia,

In formula field, Workflow and process builder you can can not loop on the existing records all records of an object. 

To accomplish your requirement, you will need to develop a trigger on your custom object, to loop on the existing records and calculate what you want.
 
Sonia GenesseSonia Genesse
Hi Waqar,

Thanks for taking the time to respond to my question. I was thinking it would have to be a trigger as there didn't seem their was any other way to achieve this.

Thanks for confirming!

Much appreciated,
Sonia