Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

I can't understand an error in Date field in a SharePoint List, condition work different as expected

(1) ShareShare
ReportReport
Posted on by 8

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 ...

 

Screenshot 2024-07-03 170327.png

 

... in some else they aren't

 

Screenshot 2024-07-03 170130.png

 

 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

Screenshot 2024-07-03 164913.png

 

 

 

... so I also try using expression null in a filed and if condition in other

Screenshot 2024-07-03 165526.png

 

Screenshot 2024-07-03 165602.png

 

 

 

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)

Screenshot 2024-07-03 165322.png

 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

 

 

 

Categories:
  • ScottShearer Profile Picture
    ScottShearer 25,150 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    @acuf 

    Try using a coalesce() expression

    Power Automate Coalesce Function Explained (zeitgeistcode.com)

  • acuf Profile Picture
    acuf 8 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    @annajhaveri any suggestion?

  • acuf Profile Picture
    acuf 8 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    Right

  • annajhaveri Profile Picture
    annajhaveri 8,531 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    @acuf  okay so you mean that the if expression you are using in the date field, is not returning null, right?

  • acuf Profile Picture
    acuf 8 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    @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 ...

    Screenshot 2024-07-03 165602.pngScreenshot 2024-07-03 165322.png

    ... 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

    Screenshot 2024-07-08 121252.pngScreenshot 2024-07-03 164913.png

     

    condition is true, so I expect that PA execute istruction in red:

    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'),''))

     

    I don't understand why I obtain a different result

  • annajhaveri Profile Picture
    annajhaveri 8,531 on at
    Re: I can't understand an error in Date field in a SharePoint List, condition work different as expected

    @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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard