web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Format Date on Second ...
Power Automate
Unanswered

Format Date on Second Record Read into Flow

(0) ShareShare
ReportReport
Posted on by 117

Hello!

 

I have a power automate that is triggered when a new Audit record is added to a Share Point Request list. That record contains the  ID of the parent record that it is associated with:

 ID (auto assigned by Share Point)ID of the Parent
Share Point List Audit158
Share Point List Summary8 

 

The Audit record is read first and then the ID of the Parent is used to read the Summary record. The flow is formatting an email and needs to format the Summary record Created (only want the date portion, not the time). When formatting the email, the Summary record 'Created' does not show up in the Dynamic content to select.

 

After the read of the Summary record, I tried to insert an Initialize Variable (and then was going to do substring to extract only the date portion):

Power App Error.jpg

The flow errors with:

 

Flow save failed with code 'InvalidVariableInitialization' and message 'The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'Apply_to_each'.'.

 

Any thoughts on how to get the Create (date portion only) from a second record that is read in a flow?

 

Thank you in advance for your help!

Categories:
I have the same question (0)
  • mahoneypat Profile Picture
    1,720 on at

    You can initialize your variable before the Apply to Each and then use Set variable to change it to the value from the current item with each iteration.  Also, you can format your Created datetime within the Apply To Each using item() in an Expression.

     

    For example,

    formatDateTime(item()?['Created'], 'MM/dd/yyyy')
     
    Pat

     

  • luvagoldenk9 Profile Picture
    117 on at

    Hi Pat!

     

    Thank you for the quick response.

     

    I had to initialize an array variable and saved the formatted Create date per your format DateTime guidance.

     
    When the array variable for Create date is referenced in the email, the date displays as:
     
    ["02/15/2021"]
     
    Do you know if there is a way to clean up the array variable (remove the leading [" and trailing "]) so that only the date 02/15/2021 is displayed? Thank you for your help!
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard