cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gme-eg
Helper IV
Helper IV

How to extract Year and Month values from Date field in share point list

Now I have a flow that syncs any new office outlook events to a SharePoint list

In the list, I have the Month and Year columns(Single text type) I would like to make them get the Year and Month values from the start date column.

I inserted Apply to each step >> Compose for Year Expression>> Compose for Moth expression  as below but I got error when I run the flow.

formatDateTime(triggerOutputs()?['body/start'],'MMMM')
formatDateTime(triggerOutputs()?['body/start'],'yyyy')

 

 2021-04-08 12_54_07-Inbox - ghada.mehrez@flsmidth.com - Outlook.png2021-04-08 12_53_15-Inbox - ghada.mehrez@flsmidth.com - Outlook.png

2 REPLIES 2
tom_riha
Super User II
Super User II

Hello @gme-eg ,

the error tells you that the

triggerOutputs()?['body/start']

 is empty (= null). It's either empty or you're not using the proper dynamic content.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Mari
Microsoft
Microsoft

Hello @gme-eg 

Based on the screenshots and the explanation you shared, the Date value comes from the Get events (V4) action, so your expression should not use triggerOutputs(). Instead, you could use this in the Compose: 

 

formatDateTime(items('Apply_to_each')?['start'],'MMMM')

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (52,495)