The Situation
Users needed to see how many accepted Purchase Orders were associated to a Job on the Job page layout. There is a many-to-many relationship between Jobs and Purchase Orders, with Job PO Assignment as a junction object
The Solution
I knew that I would need to use the Job PO Assignment to create a Rollup Summary to the Job object. I already had a PO Status field on Job PO Assignment, but Rollup Summaries cannot be based on a formula field…so I did the following:
- Create a text field on junction object
- Populate text field with Process Builder
- Create a Rollup Summary field based on the text
Why not use Declarative Lookup Rollup Summary?
DLRS is triggered on insert or update, and the PO_Status__c field on this object is a formula, which will not be an edit when the text changes ☹
Step 1: Create a text field on junction object
Step 2: Populate text field with Process Builder
For this requirement, I already had a PB on the Purchase Order object that was based entirely on changes to the PO Status field. I added an action at each criteria node that updated any Job PO Assignments related to the Purchase Order.
Step 3: Create a Rollup Summary field based on the text:
I only want to count Job PO Assignments where the PO Status Text field = “Accepted”, so the field is named Accepted POs.
End Result:
Although a Job may have a Purchase Order Assigned, users know that there must be an Accepted PO before proceeding with work.