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
Ben Merton 17Ben Merton 17 

Stuck with a flow...

This is linked to this question, but is distinct so I am posting separately:  https://developer.salesforce.com/forums?id=906F0000000BaCvIAK

I am trying to achieve the following function:  On a Purchase Order object, I have a bunch of Tax Line Items.  These are triggered by PO Line Items, meaning that every Purchase Order will have both PO Line Items and their associated Tax Line Items.  The number of taxes for each PO Line Item MAY be as much as five, meaning that each PO could have 5 times the number of PO Line Items.

I therefore need to create a summary object for the Tax Line Items, called Tax Summaries.  I am trying to do this with Visual Flow by using an autolaunched flow that is called from a Workflow when any Tax Line Items is edited/created.  This is working fine for one Tax Line Item.  It correctly loops through all the Tax Line Item records and, based on the attributes, it sums up the Total Tax Amount and inserts it.  Below is a screenshot of the functioning flow:

User-added image

The problem is that I now want the same action above to be performed on all the Tax Line Items relating to a PO, whenever ANY tax line item is updated.  I have tried the following:

1.  Modifying the flow above to include a preceding loop

User-added image

This is giving a bunch of weird errors and I have lost confidence, although it seems like the most likely route that would work.

2.  Creating another flow with a loop that runs through a collection of PO Tax Line Items and calling the flow from there.  This is giving me SOQL limit errors

3.  Trying to run another flow that will update all the Tax Line Items indepedently:

User-added image 

This is giving me a lot of errors like this:  The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30136000000LR6n. Contact your administrator for help., 

I am not sure whether what I am looking for is even possible (it is essentially a workaround on the fact that Visual Flow can't perform the set function).  I have spent hours on this and have lost confidence that ANY of the strategies can even work.

Please help!!!!