[SalesForce] Need Help on Roll up Summary Fields

I have two objects Test Plan ( Master ) and Test Plan Script ( Detail). Test Plan has 2 roll up summary fields – "Scripts passed" and "Scripts failed" where summary type = count and filter condition = Test Status = Passed, Failed. Test Status is a picklist field on Test Plan Script.

There is another field "Master Test Plan" on Test Plan which is a self look up to same Test plan object.

Roll up summary fields are able to get the count of passed and failed Test plan scripts which are directly linked to their Test plan

Issue is when Master plan has related sub test plans ( sub test plans have test plan scripts ), rollup summary field shows zero passed zero failed even though its sub test plans have some test plan scripts passed and failed.

Can we achieve the cumulative count of test plans scripts passed/failed on the master test plan by creating new formula fields or creating bucket fields in the reports.

I hope my question is not confusing and wanted to know if we can achieve with out apex code.

Best Answer

This answer assumes that the parent child relationship between Test Plan and Sub Test Plan only goes one level deep. I created a hyperlink formula field on the Test Plan to link to the Parent record which will either be itself or Master Test Plan when available.

HYPERLINK("/"&BLANKVALUE(Master_Test_Plan__r.Id, Id), BLANKVALUE(Master_Test_Plan__r.Name, Name))  

I then used this formula field to summarize the data on a Test Plan report to sum the pass and fails of the Sub Test Plans as seen in this image:
SampleReport
Same report with details:
SampleReportDetails

Related Topic