cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kriggo15
Post Patron
Post Patron

Help writing SharePoint Created date to SQL table

I need some assistance with a flow I'm creating. The flow is supposed to take the items in a SharePoint list on a given frequency, write them to our SQL DB, then delete the SP records.

 

My flow is failing when trying to write the SP Created date to the Created (datetime DataType) field in my SQL table. I've tried modifying a solution I found to a different problem here but am still having issues.

I tried the below code but got the error in the screenshots.

 

convertToUtc(outputs('Get_items')?['Created'], 'GMT Standard Time')

flow1.pngflow2.png

 

7 REPLIES 7
kriggo15
Post Patron
Post Patron

I've tried the following code but am still receiving errors.

1. convertToUtc(outputs('Get_items')?['body/Created'], 'GMT Standard Time')
2. convertToUtc(outputs('Get_items')?['value/Created'], 'GMT Standard Time')
3. convertToUtc('Get_items'()?['Created'], 'GMT Standard Time')

Error: One or more fields provided is of type 'Null', a different type is expected.

 

v-alzhan-msft
Community Support
Community Support

Hi @kriggo15 ,

 

Please take a try with expression below:

convertToUtc(items('Apply_to_each')?['Created'], 'GMT Standard Time')

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-alzhan-msft, unfortunately that resulted in an error seen below.

InvalidTemplate. Unable to process template language expressions in action 'Insert_row_(V2)' inputs at line '1' and column '22920': 'The template language function 'convertToUtc' expects its second parameter to be a time zone matching the time zone indicated by the timestamp. The provided value '(UTC+00:00) Dublin, Edinburgh, Lisbon, London' is not valid or does not match the timestamp '2020-09-22T12:07:09.0000000Z'. Please see https://aka.ms/logicexpressions#ConvertToUtc for usage details.'.

Hi @kriggo15 ,

 

Please share the configuration of the flow and the expression that you use.

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @kriggo15 ,

 

Does your issue still exists?

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

While probably not the best way to solve the problem, I did find a workaround:

formatDateTime(items('Apply_to_each')?['Created'],'yyyy-MM-ddThh:mm:ssZ')
e-rodrigues
Frequent Visitor

Hi @kriggo15 ,

 

An option would be to apply this solution from another post I've found here - which uses the "Convert time zone Action" 

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,233)