Hi,
someone can help me to understand what it's going different on managing a date from email body when I try to store it in a SharePoint list field?
I have to retrive information from an email
between various data to retrive I have also 2 field date ... these fields in some email are present ...
... in some else they aren't
so, I try to manage presence or not of the information with a if condition:
if(equals(first(skip(split(first(split(body('Da_HTML_a_testo_-_corpo-email'),'To:')),'From: '),1)),null),null,replace(first(skip(split(first(split(body('Da_HTML_a_testo_-_corpo-email'),'To:')),'From: '),1)),decodeUriComponent('%0A'),''))
but, when the field isn't present in the email body I obtain an error:
OpenApiOperationParameterTypeConversionFailed
The 'inputs.parameters' of workflow operation 'Crea_elemento_-_landing-page' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/DateTo' is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'.
... and in the execution plan I can see that as result of the expression i obtain an empty string
... so I also try using expression null in a filed and if condition in other
and with the expression null I get the result I expect null value in the field and no error (the error in the screenshot is for the second date field, with if condition)
finally I verify if condition "equals(first(skip(split(first(split(body('Da_HTML_a_testo_-_corpo-email'),'To:')),'From: '),1)),null)" and it's true than I undestand that expression have to return null as the same of expression null without if condition
Any help will be great
Thank you
Try using a coalesce() expression
Power Automate Coalesce Function Explained (zeitgeistcode.com)
@annajhaveri any suggestion?
Right
@acuf okay so you mean that the if expression you are using in the date field, is not returning null, right?
@annajhaveri thank'you for you answer, I'll try to explain better my issue
if I use a simple null expression in date field it's work fine ...
... but I need to manage properly the presence of the date in email body, when I use a condition I expect to obtain same result but I obtain a empty string and not a null field, and the flow generate a error
condition is true, so I expect that PA execute istruction in red:
I don't understand why I obtain a different result
@acuf i am not sure if i understand your issue, if you provide date value as null in action that works, right? So which condition are you facing the issue with?