Search code examples
jsonpower-automateadaptive-cards

Set Adaptive Card to Currency With Parameter From Apply to Each?


Currency Example1

enter image description here

In the image above it changes the adaptive card to Currency. How can I add this with a parameter from somewhere else? I am trying to do this but it is not working.

"value": "${formatNumber(@{items('Apply_to_each')?['Cost Each']}, 2)}"

How can I get this code to show as currency? It seems to be that when I use "@{items" it will not work. Any suggestions? Here is the adaptive card. I am looping through Excel data and want to put the Parameters I received from Excel into an Adaptive Card and use the $$ Format.

{
  "type": "AdaptiveCard",
  "body": [
      {
          "type": "Container",
          "style": "emphasis",
          "items": [
              {
                  "type": "ColumnSet",
                  "columns": [
                      {
                          "type": "Column",
                          "items": [
                              {
                                  "type": "TextBlock",
                                  "size": "Large",
                                  "weight": "Bolder",
                                  "text": "**PART APPROVAL**"
                              }
                          ],
                          "width": "stretch"
                      }
                  ]
              }
          ],
          "bleed": true
      },
      {
          "type": "Container",
          "items": [
              {
                  "type": "ColumnSet",
                  "columns": [
                      {
                          "type": "Column",
                          "items": [
                              {
                                  "type": "TextBlock",
                                  "size": "ExtraLarge",
                                  "text": "New Part Approval",
                                  "wrap": true
                              }
                          ],
                          "width": "stretch"
                      }
                  ]
              },
              {
                  "type": "FactSet",
                  "spacing": "Large",
                  "facts": [
                      {
                          "title": "Part #:",
                          "value": "**@{items('Apply_to_each')?['Part Number']}**"
                      },
                      {
                          "title": "Description:",
                          "value": "@{items('Apply_to_each')?['Description']}"
                      },
                      {
                          "title": "Quantity:",
                          "value": "@{items('Apply_to_each')?['AOQ']}"
                      },
                      {
                          "title": "Cost Each:",
                          "value": "@{items('Apply_to_each')?['Cost Each']}"
                      },
                      {
                          "title": "Sell Each:",
                          "value": "@{items('Apply_to_each')?['Sell Each']}"
                      }
                  ]
              }
          ]
      },
      {
          "type": "Container",
          "items": [
              {
                  "type": "ActionSet",
                  "actions": [
                      {
                          "type": "Action.Submit",
                          "title": "Approve",
                          "style": "positive",
                          "data": {
                              "id": "_qkQW8dJlUeLVi7ZMEzYVw",
                              "action": "approve"
                          },
                          "id": "ApproveID"
                      },
                      {
                          "type": "Action.ShowCard",
                          "title": "Reject",
                          "style": "destructive",
                          "card": {
                              "type": "AdaptiveCard",
                              "body": [
                                  {
                                      "type": "Input.Text",
                                      "id": "RejectCommentID",
                                      "placeholder": "Please specify an appropriate reason for rejection.",
                                      "isMultiline": true
                                  }
                              ],
                              "actions": [
                                  {
                                      "type": "Action.Submit",
                                      "title": "Send",
                                      "data": {
                                          "id": "_qkQ8dJlUeMVi7ZMEzYVf",
                                          "action": "reject"
                                      }
                                  }
                              ],
                              "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                          },
                          "id": "RejectID"
                      }
                  ]
              }
          ]
      }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.2",
  "fallbackText": "This card requires Adaptive Cards v1.2 support to be rendered properly."
}

enter image description here


Solution

  • sorry for that.

    Just asked a colleague and the new Adaptive Expressions, the one you're using there to format currencies are actually not working on Power Automate yet.

    Power Automate is not updated to the latest Adaptive Cards version so some of the things you can do with cards are not available in flows yet.

    Tim