Issue with custom letter field - auto nesting

Options

I've been trying to create a custom letter for acknowledgements and am running into an error when inputting additional fields.

Working from the default flow listed here I've created a letter that will include a receipt amount. After following the steps from the Build Templates tutorial I'm finding every time I input the dynamic content receipt amount to the Populate a Microsoft Word template the flow automatically updates and creates an additionally nested “for each” loop. The same goes for appending the values to the array.

I've tried inputting different values in the field and some will cause the same error, however others (such as the Gift Amount) come out fine with no error. I have a pretty low-level understanding at this point of custom flows and editing things outside of the default templates so any help would be great.

ee766f1292cdf3aa424fab531a8c4b84-huge-fi
34863c6a95c83f01bbd12e3b1cc937fb-huge-fi

Comments

  • Glen Hutson
    Glen Hutson Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant

    Hi Connor,

    The reason why you're running into that issue is that some aspects of the records behind the scenes support multiples, even if they're not actually in use right now, or if you only use one. For example, think of split gifts. Even if you don't actively do split gifts, the system behind the scenes still needs to account for that possibility. If you were to try to pull in Fund information for a gift, you'll see the same thing (automatically putting in a loop). If there's even the potential of having multiples, it automatically throws in a loop in order to account for all the multiples.

    The next question is “if I know I'm only going to have one of X, how can I keep a loop from showing up?”. There is a Mini Skills lab (see https://community.blackbaud.com/forums/viewtopic/586/58330 ) that covers this scenario, with a focus on Fund Description and Payment Method. The same thought process can be applied to most anything else in the same scenario.

  • Here's what I did:

    In Compose, I put in the expression item()['receipts'][0]['amount/value'] then formatted the number and dropped that into the template.

    289ca76dfd77555f2f54460c5d001af2-huge-im
    c18159ceae69e770558b05367c637d1d-huge-im
    3a4420deadf2026e89ee8bcabee54073-huge-im
    6bceb55c8cf739a761780ca15330a1e0-huge-im
    b6be8e43f962142334bd62daa90a4b27-huge-im
  • Thank you!! I was able to work through it from Glen's response however I ran into the issue of grabbing the value rather than the amount, until I read your answer.

  • Glen Hutson
    Glen Hutson Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant

    Connor Pearson:

    Thank you!! I was able to work through it from Glen's response however I ran into the issue of grabbing the value rather than the amount, until I read your answer.

    Glad you got it worked out. One point for you or those that may be reading this later. You may come across some areas that may “randomly” pop up a loop. You may think to yourself “wait, the system doesn't even allow for multiple [insert item]”. When the APIs were being created, the decision was made to allow for multiples of certain items “in case” in the future we built that in. It doesn't mean we will, but more of a just in case so the APIs wouldn't have to be redone. For those scenarios, this method can still be used.

Categories