Spouse Code only certain ones for Receipt

Options

I am working on a receipt flow and I want to look at the primary donor code of the spouse and see if it matches a special list of donor codes that we have when we want to send to both parts of the couple.

For example, if the spouse has a code of Trustee and the donor has a code of Alumni, then we want to address the receipt to both of them. If the spouse code is a Friend then it won't be addressed to both of them. There are 11 donor codes that we want it addressed to go to both.

What I have doesn't work, it returns false even though it should be true. Details below.

Part 1 of the Spouse part- I filter the Spouse constituent codes by Sequence =1 and then append it to a string. See below, the spouse primary code is Trustee Spouse/Partner

734c8fee04f237bf4568ab5e5577cc1f-huge-im

I have loaded the codes into a simple table which is the List rows present.

82b27dceec9b032aea3c37941ff9d8d5-huge-im
d6f582465505af0a47a099f5f7cad9c6-huge-im

Then I loop through them and my condition is my variable above.

Spouse Donor Code is equal to

items('Apply_to_each-Compare_to_See_if_Spouse_should_appear')?['Spouse Donor Codes']

This is where I get false even though they should be true! The spellings are correct on both ends. Any other tricks I can do to make this work? Also, this is time consuming in the flow. If the Spouse code is in the list then I pull the Combined Mailing Name instead of the Single Address Name.

Thanks!

Carol

Comments

  • Hello- I figured it out and got some guidance from a search I did on finding a value within an array. I'm not sure if it's correct but it works. It still takes a long time to run. I thought I would share in case anyone tries to do this.

    I had to convert my Primary Spouse Code to an array instead of a string because it told me it didn't like it as a string.

    25c393b925196640a6f4797b55b5b004-huge-im

    Created a Select on the single column from my Excel table and then a Join to put a comma in.

    e09c58821561fea4cb2d81b736d751ae-huge-im

    Then did an apply to each on the Sp Donor Code Array

    3e94b281558c244ea923290fb79f9d3a-huge-im

    The condition is the Join Output from above contains the item (). The item is the Sp Donor Code Array which contains the Primary Donor Code.


  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Carolyn Grant
    Glad you got things to work, however, if you find your run is too long, let's try to trim it down:

    First to make sure my understanding of your situation is correct:

    • You have a SharePoint excel file that contains constituent code that if the spouse record has it, you will format the addressee/salutation differently.
    • I'm going to assume that since spouse has constituent code, that means your org record spouse as separate constituent record, not non-constituent spouse

    The way to trim things down is to use less Apply to Each. You have 2 arrays: 1 array of spouse constituent codes and 1 array of constituent codes that you seeking to match to (from your “select” action). You do not need to do a Join action nor Apply to each 2 action. You can have a Condition action after your select and do an expression of length(intersection(spouse_array, excel_code_array)) greater than 0, the TRUE path you will set addressee/salutation with spouse, FALSE path you won't.

    intersection expression looks at the 2 array and produce a new array of value that exists in both array. Meaning, if the length of intersection expression is greater than 0, means the spouse constituent code array has a value that is same as excel code you seek.

    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#intersection

  • @Alex Wong- thank you for this, it worked perfectly! I'll remember to use it when looking at two arrays and comparing them.

Categories