I am trying to create a Power Automate flow that checks for a contact from all emails and then creates one if it does not exist.
{
"type": "If",
"expression": {
"and": [
{
"equals": [
"@equals(length(body('Filter_array')), 0)",
0
]
}
]
},
"actions": {
"Create_contact_(V2)": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"folder": "AQMkADMwZjRiMTZmLTc4ZWEtNGQyMC05M2Q1LTY4ZTI5N2VmYjY4NwAuAAAD3MWbPv0Iu0_pNfl_hgA7WQEAUcrfp-hZB0qX0pC_qyj8zQAAAgEOAAAA",
"item/givenName": "@first(split(triggerBody()?['from']?['emailAddress']?['name'],' '))",
"item/homePhones": [],
"item/surname": "@first(split(triggerBody()?['from']?['emailAddress']?['name'],' '))",
"item/displayName": "@concat(\r\n last(split(triggerBody()?['from']?['emailAddress']?['name'],' ')),\r\n ', ',\r\n first(split(triggerBody()?['from']?['emailAddress']?['name'],' '))\r\n)\r\n",
"item/emailAddresses": [
{
"name": "Work",
"address": "@triggerBody()?['from']?['emailAddress']?['address']"
}
]
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
"connection": "shared_office365",
"operationId": "ContactPostItem_V2"
}
}
}
},
"else": {
"actions": {}
},
"runAfter": {
"For_each": [
"Succeeded"
]
}
}