NXT Adaptive Card to display custom fields

Options

I'm new to Power Automate and have been following tutorials/templates/examples from the community here, slowly getting a handle on how it works with NXT. But now I'm doing a custom project and I've hit a wall – I'm not even sure what options are available to me as a solution.

Our system has a custom field called Interest Area, and we're refining how this is used. As part of that project I want to ‘surface’ that data so it's easier to find (i.e. because if a constituent has more than five custom fields older ones get buried). I'm looking to create an adaptive card that displays the custom field category (Interest Area) and the value (the interest, set as a code table value).

I've been able to build a flow that initializes a variable, uses the List Custom Fields action, filters the result to only the Interest Area category, then displays the value in a card. But I only get the earliest custom field entered on the record, and don't know how to get more than one.

I've tried creating a variable array; incrementing the variable; using Apply to Each to get different variables for additional values; I can't get anything to work, but this is just a reflection of my lack of experience. I'm not sure where to begin to troubleshoot – any ideas?

I'm happy to share the code but I'm not sure which steps would be helpful. Really all I need is a way to set multiple variables from the List step, each with different values, and display them all in the card.

Thanks!

Comments

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

    @James Parsons
    You can use an array variable to store the “multiple” value of Interest Area, but then you will need to make sure you use the join() expression to join the multiple values into ONE string to display back on the adaptive card.

    You do not need to use variable at all if use some data actions.

    • list constituent custom fields
    • filter array of custom fields by category
      • this give you an array of custom fields object (i.e. object that contains subproperies such as value, ID, category, etc)
    • SELECT action to select ONLY the “value” property from the array of object
    • use join() expression on the SELECT body dynamic content to join the multple values with a delimitor:
    df6166b5331f2aa2c37a52f947c555f6-huge-im
    no need for apply to each loop
    f4a0278d1b03fd02ebfe228415bd0eea-huge-im
    make sure you select the value dynamic content that has description “The set of items included in the response…..”
    f62f8f05c76e51a69006c9da061d2e27-huge-im
    use “Body” of Filter array dynamic content
    26e4da091beb6f75894e06f0a66d7606-huge-im
    join(body('Select'), '; ')
  • @Alex Wong
    This is amazing, thank you! I think I'm getting a better understanding of how these pieces fit together too.

    This works, but the result I get contains a lot of extra characters:

    56525551a7c7978fc30e293860d0c904-huge-sc

    I've tried a few things but can't seem to avoid this. Am I right in thinking it's literally printing the array?
    I think this is related to the Filter Array step; your instructions note to use the Value with the description “The set of items included in the response…” I don't have (exactly) this option; mine is body/value (the Value option adds the For Each loop because it's iterating through the list). Is the problem that it's picking up on more than I need?

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

    @James Parsons
    the important steps are in the Select action and the join() expression, so please show run history of these actions and the edit mode of these actions.

  • @Alex Wong

    Here is the edit window for the Filter Array action:

    9d0ed5df8c4196267d9998251aa814c6-huge-im

    And this is the value in the dynamic content menu:

    04e4fd557b1f299081f4b7e7031467c4-huge-im

    The Value (you see in the first image) doesn't have the description “the set of items…” and when I add it, it automaticalyl goes into a For Each loop. I don't think body/value is right either, but that's the only other option.

    As for the join expression, I copied what you noted and entered it as a function:

    4a3cf910d7521704e6295df32c237938-huge-im

    This doesn't appear to work at all because the delimiter isn't showing in the result.

    I also noticed that the extra :"" I see in the result is becuse of the key/value pair in the Select action. I had the value in the key field initially. Your image shows only the map, but if I leave the key blank I get these characters.

    As for the run history, there have been no errors – everything executes as expected. But I wonder if there's an error in my Select action – here's the Output:

    [ { "Interest": "Indigenous" }, { "Interest": "Diversity and Inclusion" } ]

    …which is exactly what's showing in the card. It's like the flow is skipping the Compose action (with the join expression) entierly.

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

    @James Parsons
    You are using the “new designer/editor" so it looks different.

    Filter array From needs to be the dynamic content that has the description that say “The set of items included in the response…” NOT the one that has description that say “The value of the custom field”. so from your 2nd screenshot, the one that is “body/value” is good.

    2ded6572d9255f4cef6af3be0ab4865d-huge-im

    Your join() expression is good, but your Select action is likely wrong, you didn't have screenshot of it.

    I am going to suspect this is what you have:

    4653afe46efd2e6792ba1aab61e28cd5-huge-im

    which is making an array of object with 1 property:
    [ { "Interest": "Indigenous" }, { "Interest": "Diversity and Inclusion" } ]

    Instead:

    56a0af1cc542d33d2b709dd18f435d10-huge-im

    this is to make an array of string, not array of object:
    [“Indigenous”,"Diversity and Inclusion"]

  • @Alex Wong Thanks so much, this is perfect!

    I did have the Select action you guessed, and fixed that. The card still wasn't populating as I expected – but this turned out to be an error in the Compose action that creates the adaptive card (I had the wrong output). I fixed that, and except for some minor formatting changes, this is now working as expected. I'm very excited; this opens a lot of potential for us.

    Thanks for your help!

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

    @James Parsons
    That's great to hear.

    If you are only displaying information, this is good starting point.

    If you decided that you want to do more: display, user input, update, and display new info/more info, check out my template for AIAC: All-Inclusive Adaptive Card

    https://community.blackbaud.com/forums/viewtopic/586/69847

  • @Alex Wong Yes, I've already bookmarked that one. :)

    We don't use Sharepoint (yet) but it's something I want to explore. I have a lot of ideas for how to use this kind of template.

Categories