Reputation: 11
I have set automate up to parse an email i recieve regularly. The email is system generated through third party software without an API to link directly to SharePoint.
I have used the initialise variable function to parse the HTML from the email and create a new list item.
All fields work, however the Date will not pull through and fails the flow entirely.
I get this error:
The 'inputs.parameters' of workflow operation 'Create_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/DateTime' is required to be of type 'String/date'. The runtime value '"25/02/2022"' to be converted doesn't have the expected format 'String/date'.
My column settings in the List are Date & Time field with Date Only set.
Upvotes: 1
Views: 15178
Reputation: 189
You can also parse the date time and then use formatDateTime
to output the format you want, see below:
formatDateTime(parseDateTime(variables('Date Time String'), '', 'dd/MM/yyyy'))
Note: In the example above I did not specify a format for formatDateTime (only the parsing step), this will default to outputting the datetime in ISO format which is compatible with SharePoint.
Upvotes: 0
Reputation: 11262
I hope I've understood your problem correctly but the format 25/02/2022
is not considered to be a valid ISO 8601 date.
I created a variable called Date Time String
and stored your date of 25/02/2022
.
To make it valid, you need to convert it and to do that, this expression should do the trick.
concat(split(variables('Date Time String'), '/')[2], '-', split(variables('Date Time String'), '/')[1], '-', split(variables('Date Time String'), '/')[0])
It essentially reverses the date into a format that SharePoint will accept.
Upvotes: 0