Sharing my Power Automate template: Add custom field based on list

Options

Description: Use this flow to add a custom field to constituent records in a list if the custom field is not already on the record.
Required connections: Blackbaud Raiser's Edge NXT Constituents
Suggested skill level required to use this template: Beginner
Category: Power Automate, Data Health
Instructions: *Read through the notes on each step of the flow for further details and background on the purpose of each step.*

  • Create a list in NXT web view.
  • Choose your list within the List Constituents step.
  • Click on Apply to each - Constituents from List, and then click Condition - Checks True False.
  • Update the condition and the Yes branch of the condition with the custom field information you want to add to constituent records when necessary.
  • It is recommended to test this flow with a sample list containing 1-2 constituent records before applying to all records that meet the criteria.

The list initially used in this flow grouped together donors who have given $1k+ in the current fiscal year. The flow runs nightly on all donors currently in the list to see if the custom field relating to this giving level is already on the record (with the help of a variable). If the custom field does not exist, it is added to the constituent record. The flow checks all records in the list each time it runs.

Addcustomfieldbasedonlist_20221031204952.zip

Comments

  • @Torie Wright - for the list constituents step under List am I supposed to put the name of my list or the ID number of my NXT site or what goes here?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    if you see a X to the right of the field for List, click on it first.

    2d7666fafb1846ceb2a50bb257cb7053-huge-im

    Then you should see a “down arrow” icon that you can click on to see a drop down of list for you to select.

    64863ea69932127e2721eafd415032ab-huge-im

    the action is made such that it let you select the list with the name of the list, however, IF you ever going to use the “Enter custom value” (generally when you dynamically create a list, and want to get the list's constituent, you will use this option), then you will need to make sure you get the List ID, not name of List.

  • c4b75258b01fd62e4bf712edefc2b4f3-huge-24

    @Alex Wong - thank you! When I pull down the list it must be the list of custom fields for Torie's database. The only steps before this step that I could put my NXT ID is this one:

  • @Alex Wong - forgot to ask how do I find list ID?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    Go to the list you want to use, and click on Share.

    61f0faa97bad2cc01d599853a37e4117-huge-im

    Copy the URL and paste to a notepad.

    https://host.nxt.blackbaud.com/lists/shared-list/1a23bcde-45b8-41ef-9451-3f07a0c54443?envid=z-abcdE1fghJkLm_mOpQrstuv

    the RED part is the List ID.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    the action to put the “list id” (or select from dropdown) is the “List Constituent” action

    you will also need to decide on how you want to have your constituent attribute, which will affect the flow workingness. once you decided on how you want your constituent attribute, you can put the info here, and I can advise you on how to fix up the flow for your own need.

  • @Alex Wong - as always you are the best!

    Ok, I found the list constituent step but I'm not following what you mean by ‘how you want to have your constituent attribute’

    Do you mean the descriptions based on the constituent attribute (thank you for showing me how to get the ID BTW)?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    the original flow uses a specific constituent attribute category: Audience Code

    With a specific Description: HAC Member and Comment: FY23

    This means you need to setup a constituent attribute category in your RE NXT of Audience Code with a Description of HAC Member (code table entry or the attribute has to be TEXT).

    the flow also statically uses FY23, which means every end of year/begin of year, the flow has to be changed (maybe the Constituent List saved in RE NXT need to be changed too depending on how you setup your list).

    So what I am saying is, if you thought through how you want to record your constituent attribute (custom field in RE NXT webview terminology), and if it differs from what the original post's RE configuration, then post that details here, and I can help you modify the flow to your configuration

  • @Alex Wong…I want to use this for custom field category of Award with description of Impact

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    is “Award” category unique (only allow one?) or is the “combination” Award=Impact unique

  • @Alex Wong…Award is a custom field that can be put on a record more than once but Award category with description Impact is unique (only allowed or I only want it on the record once)

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Joanne Felci
    I'm going to provide some change to the original flow that you download and import, and apply a little efficiency to the logic.

    Delete the following actions:

    • Initialize variable - CustomFields
    • Apply to each - custom fields from single constituent record

    After the List constituent custom fields action add an action Filter array and put the value (the one with the description that say “The set of items included in the response…”) dynamic content in the From field of Filter array

    b1486ceadc979d3e67f2a18b065ea4e9-huge-im

    Then click on Edit in advanced mode and paste the following in:
    @and(equals(item()?['category'], 'Award'), equals(item()?['value'], 'Impact'))

    1e2122b9c2b1163976e421475f340bf7-huge-im

    The Filter array action will avoid the need to loop through each constituent codes of a constituent and condition on result where the attribute category is Award and value is Impact.

    Next we will condition on if the filtered result is equals to 0, if yes, add the constituent attribute:

    73fe367e68c039dfc4b5fd3011b18f16-huge-im
    Go to the expression tab and enter: length(body('Filter_array'))
    07f9ff302107cabc406b56ba75bc333d-huge-im
  • @Alex Wong

    I've downloaded and modified this flow as per the instructions, I think. I'm getting an early error at the Apply to each Constituents from List section.

    "Action 'Condition' failed: Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'length' expects one parameter: an array or a string the length of which is returned. The function was invoked with '0' parameters. Please see https://aka.ms/logicexpressions#length for usage details.'."

    f4b7b266a6e04afd600dbd0ea43b512e-huge-ad

    I'm not able to pull up value. I have to choose body/value in the Apply to each step, so I'm not sure what that is about. It is probably causing the error.

    dfbf2b197e17441118e93f8cb27c227d-huge-ap


  • @Sean Pflueger - Hi Sean, I know you tagged Alex here but I thought I would start asking some questions. All I see in what you posted is a List Constituents action. Are you trying to add a custom field to those people? Do you need to check to see if they have the custom field already?

    It's hard to tell where it is failing. I think it might be looking at the count of constituents that are returned. Can you put in the length as it is?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Sean Pflueger
    Apply to each is 99% of the time not the reason for failure. The “new view” is really bad at guiding you to see where the real issue is for troubleshooting.

    From your error message, it is telling you that the problem is in the Condition action within the Apply to each, where the Condition action is using an expression length() which is failing b/c it was not provided an array or string to get the length of, you provided nothing (meaning, your expression is length() only, instead of length(dynamic_content_of_array).

    Show screenshot of the Edit mode and run mode of the Condition action in OLD view (not new view).

    f4da796e5930c83bee0e2364f468e9d8-huge-im
  • @Torie Wright Thanks so much for sharing this flow :) Worked like a charm. I'm using it to keep records created by the system (event registrations) to end up in other flows when I'm just going to merge and delete the records anyway!

  • @Carol Grant
    I'm trying to add an Attribute on to records that do not have one if they land on the Donor list I've created. These are all new records, so they shouldn't have one.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Sean Pflueger
    As I suspect, your length() expression on the left side of the compare does not have any parameter passed in to check the length of.

    You will need to click on the length() dynamic content, and it should pull up the Expression editor.

    click inside the paranthesis:

    65f9ac3accdd7984bf31e21b87a0c308-huge-im

    and then select the “value” dynamic content that is from the list constituent action.

    HOWEVER,
    From looking at your screenshots, your flow is in a mess with too many “for each”. From the screenshots, it looks like the flow is doing:

    • get constituent list
    • apply to each constituent
      • list the constituent custom fields
      • Another “for each” which I can only assume you are “looping each constituent custom fields”?
        • filter array, i don't know what you are filtering
    • condition
      • length() is equals to 0? (screenshot is blurry, so i can't see if it's 0 or 8
        • if yes
          • another for each - i can only assume this is looping constituent again…
            • create constituent attribute/custom field
        • if no
          • nothing

    you have way too many “apply to each/for each” loop that is not needed but will cause your flow to run for way too long even if you corrected the error mentioned above. If I understand your intention of the flow, all you need is:

    • get constituent list
    • apply to each constituent (for each constituent)
      • create constituent custom field

  • @Alex Wong
    Thank you. I simplified and took out a lot of the steps and it appears to be working. Thanks.

  • @Sean Pflueger- it's still hard to see your screens but I think in the Condition you want to have the length of the filtered array which is explained in the posts below. Is this what you have in your condition?

    length(body('Filter_array'))

    Also, I think you need your condition inside your For each loop, it appears to be outside. If you still are having issues, join us tomorrow at the Power Automate group and we can help you. Email Erik Leaver to get on the agenda.

  • @Torie Wright


    As I understand this flow will only add a custom attribute to a constituent if there is no custom attribute. Could I adapt this to also update a constituent attribute? ie donor lifetime giving is $900 so is given a custom field of "Supporter". Donor then donates $500 more which move the donor into a new giving segment. A list is pulled and and custom field updated to "Major Supporter".
  • I think I will need to add some more flow to the False code. So if custom attribute is present then replace with xxx?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Andrew Jupp
    Answer is yes, you can add update logic.

    in the update logic path, you will need to supply the update custom field with the custom field system record id, which you can obtain from the filter array action for the custom field category

Categories