cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BrianSlalomMS
Level: Powered On

Trouble converting string to date using convertToUtc

I have a text column in my custom CDS entity containing a string of a date. Most fields are empty.

I want to build a Flow which will will convert the string to a value of type datetime and update the date field in the same record, for all records in my custom entity.

Its failing with a 400, BadRequest, error. What am I doing wrong?

Attached images show the flow and the resulting error.

Source column values are either empty or in the format "7/7/1977".FlowFailDateConvert.PNGFlowFailDateConvert2.PNG

 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Trouble converting string to date using convertToUtc

Hi @BrianSlalomMS,

 

You couldn't enter the expression in the "PCN Status Date" in the "Update a record" action directly.

 

Please add a dynamic content with the expression in your "PCN Status Date" in the "Update a record" action.

 

I have made a test on my side, you could refer to screenshot below to add the dynamic content with the expression:

Capture.PNG

 

The flow would run successfully as below:

Capture.PNG

 

Best regards,

Alice

 

BrianSlalomMS
Level: Powered On

Re: Trouble converting string to date using convertToUtc

I made the change you suggested but my Flow still fails.

FlowFailDateConvert2-1.PNGFlowFailDateConvert2-2.PNG

Here is the full text of my expression.

convertToUtc(item()?['cr89e_pcnstatusimportastext'], 'Pacific Standard Time')

BrianSlalomMS
Level: Powered On

Re: Trouble converting string to date using convertToUtc

Here is the earlier portion of my Flow. I am trying to apply this update to each record in a list. Referencing each record individually is probably my issue.

FlowFailDateConvert2-3.PNG

BrianSlalomMS
Level: Powered On

Re: Trouble converting string to date using convertToUtc

Tried this as well. 

FlowFailDateConvert2-5.PNG

 

Getting closer, the correct date is filled in, but it fails with no specific error message.

FlowFailDateConvert2-4.PNG

BrianSlalomMS
Level: Powered On

Re: Trouble converting string to date using convertToUtc

Another important thing to note is that my destination date field is of type Date&Time, not string/text.

Is there some other function I should be using to convert a date string to a Date&Time field type?

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 187 members 5,475 guests
Recent signins:
Please welcome our newest community members: