Flow producing blank letter

Options

At the end of my gift digest flow, I am creating a letter for any gift which qualified for our giving society (Century Circle).

“For each gift that qualifies” is the portion of the flow that is pulling information about each gift. Once that completes, two parallel actions are initiated:

  • 1 (on the left) puts the gift information into an email.
  • 2 (on the right) is combining the giving society letters into one file and creates a task that links to the letters. This should only be created if there are letters available.
d3fa87775448f3773caaa54727af500a-huge-sc

I am having issues with the one on the right, which is to combine the letters into one file and create a task. This should only be happening if there were letters to combine. But it is performing these steps even when no individual letters were created.

Earlier in my flow (within the “for each gift that qualifies”), I have a section that is creating a letter for each gift that qualifies. This part is working correctly.

10159f6534ba9022b783cbc674d4a0a7-huge-im

Any suggestions on how to prevent the second part of the flow running if there are no letters to combine?

Comments

  • Austen Brown
    Austen Brown Community All-Star
    Ninth Anniversary Kudos 5 Name Dropper Participant

    Hi @Amanda Holt - What if you put a conditional in for the parallel section that looks for a particular identifier that would help the flow differentiate when a letter is create and when it is not?

  • @Austen Brown. I wondered about that but am struggling with how to write a condition that works. If any gift meets the criteria (or if any letter is generated for a gift), then the flow should combine the letters and create a task.

    I tried to initialize a string variable and then set that variable within the “apply to each gift." But this always resulted in false, even if one of the gifts did qualify for the giving society.

    Then I tried to initialize an array variable, once again setting that variable within the apply to each gift." This didn't work either, as the value within apply to each is a string and not an array.

  • It turns out I needed to add a loop counter. I found instructions at https://docs.microsoft.com/en-us/power-automate/create-variable-store-values under “Example: Create loop counter."

    Essentially, I initialized an integer variable at the beginning of the flow. Within my letter loop, I added an increment variable.

    a2eef097dd537d20c7979d69e83ba3bf-huge-im

    Then I created a condition: the letters would run if the variable were greater than 0.

    fe0ab58b697ebbadf0cf8e71eafa40c5-huge-im

Categories