0

Hello here is the snippet of my code and I am trying to get the AppId from this represented in the following manner in oder to send it via mail.

 {
                        "appId": "com.google.ios.youtube"
                    },
                    {
                        "appId": "com.keepassium.ios"
                    },
                    {
                        "appId": "com.markmcguill.strongbox"
                    },
                    {
                        "appId": "com.microsoft.azureauthenticator"
                    },
                    {
                        "appId": "com.microsoft.Office.Excel"
                    },
                    {
                        "appId": "com.microsoft.Office.Powerpoint"
                    },
                    {
                        "appId": "com.microsoft.Office.Word"
                    },
                    {
                        "appId": "com.microsoft.onenote"
                    },
                    {
                        "appId": "com.microsoft.rdc.ios"
                    },
                    {
                        "appId": "com.microsoft.skydrive"
                    }

What i expect is: Youtube ios strongbox ......

I tried this

enter image description here

and I got this one

enter image description here

The Problem is: if I want to send a mail this will be sent at least 23 times and it'll cause chaos. How can I group them like this:

  • Youtube
  • ios
  • strongbox

and send them once. Sorry to be long and thanks in advance for your contribution.

Skin
  • 9,085
  • 2
  • 13
  • 29
SmartGuy
  • 5
  • 2

1 Answers1

0

I have reproduced in my environment and got expected results as below:

You can use Empty array variable and Join Operator with space for this:

enter image description here

Output:

enter image description here

After this you can use Email as an action.

Code view:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "For_each": {
                "actions": {
                    "Append_to_array_variable": {
                        "inputs": {
                            "name": "var",
                            "value": "@outputs('Compose')"
                        },
                        "runAfter": {
                            "Compose": [
                                "Succeeded"
                            ]
                        },
                        "type": "AppendToArrayVariable"
                    },
                    "Compose": {
                        "inputs": "@last(split(items('For_each')['appId'],'.'))",
                        "runAfter": {},
                        "type": "Compose"
                    }
                },
                "foreach": "@body('Parse_JSON')",
                "runAfter": {
                    "Parse_JSON": [
                        "Succeeded"
                    ]
                },
                "type": "Foreach"
            },
            "Initialize_variable": {
                "inputs": {
                    "variables": [
                        {
                            "name": "var",
                            "type": "array"
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            },
            "Join": {
                "inputs": {
                    "from": "@variables('var')",
                    "joinWith": " "
                },
                "runAfter": {
                    "For_each": [
                        "Succeeded"
                    ]
                },
                "type": "Join"
            },
            "Parse_JSON": {
                "inputs": {
                    "content": "@triggerBody()",
                    "schema": {
                        "items": {
                            "properties": {
                                "appId": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "appId"
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    }
                },
                "runAfter": {
                    "Initialize_variable": [
                        "Succeeded"
                    ]
                },
                "type": "ParseJson"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {}
}

EDIT:

Used space - space here:

enter image description here

Output:

enter image description here

RithwikBojja
  • 5,069
  • 2
  • 3
  • 7
  • Thank you for your reply. It's helpfull. Do you know if it is possible to represent the output like this? I mean in form of the list like an enumeration. -strongbox - azureauthenticator -Excel - Powerpoint -Word -Word -onenote -ios- - skydrive - teams -OnionBrowser -Netflix – SmartGuy Jul 13 '23 at 11:54
  • You can use - instead of space in join operator. – RithwikBojja Jul 13 '23 at 11:56
  • Also added the same in edit section of the answer – RithwikBojja Jul 13 '23 at 12:12