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 / apply to each flow run...
Power Automate
Unanswered

apply to each flow run error

(0) ShareShare
ReportReport
Posted on by 2
Hi all,
 
I'm new to this power automate thing so take it easy on me as i'm still learning.
So, i have an API call for a form response and i'm trying to wrap all that dynamic response into an Apply to each to create the response in SharePoint, but can't get that working, also i'm getting a format issue with 2 of the fields coming through
1 filed is a Date field and the other is a phone number, the phone number can typed in various ways when the from is getting filled out.
 
for the Date field/parameter I tried to use this (formatDateTime(triggerOutputs()?['body/DateOfBirth'], 'MMMM/dd/yyyy')) in the create item flow.
The phone number I'm not sure what format to use because sometimes there're spaces in the numbers and other times all the numbers are together.
 
see below for what I have tried currently and the response/error message I'm getting.
 
The flow saves fine but, then when i test it, i get the below from the apply to each
 
{
    "foreachItems": [
        {
            "Form ID": "111122",
            "Form Name": "Test Form",
            "Response ID": "21002279",
            "Response Timestamp": "2024-11-29 14:49:58",
            "Given Name": "test",
            "Family Name": "test",
            "Date of Birth": "01/06/2001",
            "Your Postcode": "0000",
            "Phone Number": "000 111 0000",
            "Email address if you prefer": "test@test.com",
            "Preferred Language": "English",
            "Questions or Comments": "TESTING",
            "Privacy Policy Consent": "Yes"
        }
    ]
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Thanks in advance for your help.
Categories:
I have the same question (0)
  • Srini007 Profile Picture
    3,327 Super User 2025 Season 2 on at
     
    When you are in the Apply to each loop then the value should be always refer to the current Item i.e., to call the value of the date you need to write as Items('Apply_to_each')?['Date of Birth'], You can keep a compose action inside the Apply to each action before Create Item and write above expression to see whether you are getting the correct value or not
     
    Now to format the Date, you need to go to your list and check in particular date field in which format it accepts the value let's say it accepts the 04/12/2024 then you need to write as below
     
    formatDateTime(Items('Apply_to_each')?['Date of Birth'], 'dd/MM/yyyy')
     
    For the Phone Number, you can write an expression as below where it can remove the spaces
     
    replace(Items('Apply_to_each')?['Phone Number'], ' ', '')
     
     
     
    If I have answered your question, please mark it as the Answered. If you like my response, please give it a Like.
     
    Regards,
    Srini
     
  • HA-03121042-0 Profile Picture
    2 on at
    Hi @Srini007,
     
    Thanks for the prompt response,
    I have implemented the compose action and it indicates that it works but when the [Date of Birth] is specified as e.g (13/12/2002), i get the error below, aslo i have used this formatDateTime(items('Apply_to_each')?['Date of Birth'], 'dd/MMMM/yyyy')
     
    (Action 'Create_item' failed: Unable to process template language expressions in action 'Create_item' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '13/12/2002' was not valid. The datetime string must match ISO 8601 format.'.)
     
     
    Many thanks again for your help with this.

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard