Hello all
I am receiving this error message when trying to save my flow
The input parameter(s) of operation 'For_each' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'For_each'.
I have tried everything I know, and then some, and can't find a solution.
What I am trying to do is, inside a for each loop, compare each item's Coverageenddate (Coverage end date) to today's date and if the two are the same I want to change the status to expired.
In case you are thinking there may be a null value causing the issue that is not the case as I have filtered out all null values in my get items step.
I currently have in my condition's parameters placed the following code:
formatDateTime(items('For_each')?['Coverageenddate'], 'yyyy-MM-dd') is equal to '{formatDateTime(today(), 'yyyy-MM-dd')}'
I have to use the today() and not utcNow() because I need to ignore the time and just compare the dates
I have even also tried this:
formatDateTime(coalesce(items('For_each')?['Coverageenddate'], '1900-01-01T00:00:00Z'), 'yyyy-MM-dd') is equal to '{formatDateTime(today(), 'yyyy-MM-dd')}'
and
formatDateTime(coalesce(items('For_each')?['Coverageenddate'], '1900-01-01T00:00:00Z'), 'yyyy-MM-dd') is equal to formatDateTime(utcNow(), 'yyyy-MM-dd')
and
formatDateTime(items('For_each')?['Coverageenddate'], 'yyyy-MM-dd') is equal to formatDateTime(utcNow(), 'yyyy-MM-dd')
the last two using the utcNow() save without an error but then when the script runs none of the items with the matching dates are updated to expired.
below is my coding as it stands
Would someone PLEASE help me resolve this dilema?
Thanks
{
"type": "If",
"expression": {
"and": [
{
"equals": [
"@formatDateTime(items('For_each')?['Coverageenddate'], 'yyyy-MM-dd')\r\n",
"@{formatDateTime(today(), 'yyyy-MM-dd')}'"
]
}
]
},
"actions": {
"Send_an_email_(V2)-copy": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"emailMessage/To": "@item()?['RequestingManager/Email']",
"emailMessage/Subject": "Service Terminating",
"emailMessage/Body": "<p class=\"editor-paragraph\">Hello @{outputs('requesting_Manager_profile')?['body/displayName']}<br><br>@{variables('varItemLink')}has expired.<br><br>If you need the service to continue, and have not yet done so, please submit a new request<br><br>The Operations Team</p>",
"emailMessage/From": "M*********************************Automation@v*********m",
"emailMessage/Bcc": "A************a@v*********m",
"emailMessage/Importance": "Normal"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
"connection": "shared_office365",
"operationId": "SendEmailV2"
}
},
"runAfter": {
"Update_item": [
"Succeeded"
]
}
},
"Update_item": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"dataset": "https://v**********u.sharepoint.com/sites/M********************ing",
"table": "a7f74738-**************-a**********2",
"id": "@item()?['ID']",
"item/Approval_x0020_Status/Value": "Expired"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "PatchItem"
}
}
}
},
"else": {
"actions": {}
},