Power Automate- Gifts- Soft Credit formatting

Options

Hi- I'm using a power automate flow created by Dan Snyder that sends an email out listing daily gifts with name, amounts, fund name and soft credits. The soft credit names appear, but my supervisor was hoping it looked a little better if there was more than 1 soft credit found.

Currently they appear like this: Mr. Mickey Mouse 2005Mrs. Minney Mouse 2008

Can I get the names comma separated and a space between them if there is more than 1 ?

I've been struggling for a few days trying an if statement to count the length if greater than 1 then trying many things with arrays like join, concatenate. I tried split strings. Do I want the result to be an array or a string?? I tried doing an apply to each so it would loop through the soft credits but that didn't work either.

The script that works in the flow is getting the body: if there is a soft credit is an if the length(outputs('Get_each_gift_details')?['body/soft_credits']) =1

63ffc2fc4f702f91a60704f39c1235ae-huge-im

Here's the output of the array.

6a01030ec85a612147f283d1e26d476b-huge-im

Thanks for any help with this,

Carol Grant

Middlebury College

Middlebury, VT

Comments

  • Hi Carol,

    I admit that I haven't tried to conquer this scenario before.

    I wonder… would Power Automate break if you built an Array of soft credits and then embedded that Array that becomes the Gift Digest HTML table?

    Let me seek some other guidance and get back to you.

    Heather

  • This post I feel has some value on this topic:

  • Hello, was there a resolution for this? Theresa

  • Not really- I looked at the posts that Heather mentioned and I've tried many things. I'm not sure which way to go.

  • Hi Carol,

    Can you post a screen shot of the soft credit array with more than one name?

  • I do something similar with Gift Splits, so this same logic will also work for soft credits.

    First initialize a variable, type string, name it something like “Soft Credit String"

    Apply to each → Soft Credits

    {

    Control Condition : length(variables('Soft Credit String')) > 0

    If Yes:
    Append to String action on “Soft Credit String" with whatever divider you want, ie “, ”

    If No: no action

    After condition:

    Compose Action → Whatever soft credit fields you want to bring in here

    Append String action on “Soft Credit String” with Output of Compose action

    }

  • Evan- Yes, that is exactly what is in the script. Have you viewed the output if you have more than one person who receives soft credit? There are no spaces in between the names or commas.

    Ultimately, I would like it to loop through the soft credits and tell me if there is more than one and then format those with a comma.

    Hi Dan- this is what I'm been working with it that helps.

    842c3a72f43c4a4efae9c37a3d0f67e8-huge-im

  • Carolyn, it looks like your flow is different from what I suggest in that you have just one append action and no control condition to determine if you have more than one Soft Credit. Please note my solution includes a control condition with an append string action that only adds the divider, i.e. “, ”. The second append string action adds the record information.

  • Hi Evan- I've been working on this today. Thanks for your help. I think this is what you explained. My condition2 looks at the length of the soft credits body instead of the string variable because my string variable SC List is blank when I initialize.

    I pulled in the Soft Credit system ID into the Compose and I'm still not getting two system IDs combined with a comma. When I look at the output it creates two separate records for each.

    Lastly, I want to show their Name, where would I pull in Get a Constituent and pull in the Name for the Soft Credit? After the condition because it should be in the Compose, correct?

    76090f2a5257cc943748d7c09d4bd177-huge-im
    61b445b23c9601ada2345cb3fd6ecc3e-huge-im
  • Evan Webb:

    I do something similar with Gift Splits, so this same logic will also work for soft credits.

    First initialize a variable, type string, name it something like “Soft Credit String"

    I initialized the variable and left the soft credit initial value blank.

    Apply to each → Soft Credits

    {

    Control Condition : length(variables('Soft Credit String')) > 0

    But if my condition is here- it doesn't find anything because the string is empty. So I get false here and it stops.

    If Yes:
    Append to String action on “Soft Credit String" with whatever divider you want, ie “, ”

    If No: no action

    After condition:

    Compose Action → Whatever soft credit fields you want to bring in here

    Append String action on “Soft Credit String” with Output of Compose action

    }

    Unfortunately this doesn't seem to work unless I missed putting something when I initialized the variable. Does anyone else have a good way to loop around each name of the soft credit and put a comma in between?

    Thanks,

    Carol

  • Hi @Carolyn Grant ,

    In order for this to work, you need to ensure that the Compose action is outside of the condition, directly after it. The condition's only purpose is to add the separator or not. The Compose action (which adds the soft credit info) comes after the condition and should not be effected by its outcome.

  • Hi @Evan Webb- thank you for replying. I moved it out of the Condition which I understand now. Although, I'm still stuck on it returning false.

    I'm not appending anything to the Soft Credit String before it is looking at it's length so it's always zero. Condition 2 is length(variables('Soft Credit String'))

    ce324dd8a6ffb6c6093bbc2ebb9670dd-huge-im
    3cb29b9c3780e8f8be9b1fd2d1ae5153-huge-im
    174ebb0d159822923854235aab85bfe5-huge-im

Categories