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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Not able to store valu...
Power Automate
Unanswered

Not able to store values through Apply to Each Loop

(0) ShareShare
ReportReport
Posted on by 6
Friends, I have tried several tutorials but none have fully worked. I want my work flow to do the following:
Whenever someone updates the Status (field) of the Projects Pipeline list, I want to log this in another list called Status Change with info on the status changed from, status changed to, date of previous status change, current date of change. I am open to suggested. Below is just one of the approaches I took. It seems the "Apply to each" loop which is recording updates for the Status and Modified field is creating two entries instead of one.
 
I tried this:
 
The updated list result was (highlighted in red below. One entry is desired is, not two. The status field should not have date time info.
 
Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,626 Super User 2026 Season 1 on at
    What is the source for the first "Apply to each" ?
  • linkgtaylor Profile Picture
    6 on at
    Apply to Each:
     
    {
      "type": "Foreach",
      "foreach": "@body('Select')",
      "actions": {
        "Compose_Field_Name": {
          "type": "Compose",
          "inputs": "@items('Apply_to_each')"
        },
        "Compose_New_Item": {
          "type": "Compose",
          "inputs": "@triggerOutputs()?['body']?[item()]",
          "runAfter": {
            "Compose_Old_Status": [
              "Succeeded"
            ]
          }
        },
        "Create_item_in_Status_History": {
          "type": "OpenApiConnection",
          "inputs": {
            "parameters": {
              "dataset": "https://mof1.sharepoint.com/sites/SubmissionsManagement",
              "table": "3b12410c-dd4a-4300-a8b1-898e5f14aa24",
              "item/Title": "@triggerBody()?['Title']",
              "item/StatusChangedFrom/Value": "@outputs('Compose_Old_Status')",
              "item/StatusChangedTo/Value": "@outputs('Compose_New2')",
              "item/ProjectID/Id": "@triggerBody()?['ID']"
            },
            "host": {
              "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
              "connection": "shared_sharepointonline",
              "operationId": "PostItem"
            }
          },
          "runAfter": {
            "Compose_New2": [
              "Succeeded"
            ]
          }
        },
        "Compose_Old_Status": {
          "type": "Compose",
          "inputs": "@outputs('Send_an_HTTP_request_to_SharePoint')?['body']?['d']?[item()]",
          "runAfter": {
            "Compose_Field_Name": [
              "Succeeded"
            ]
          }
        },
        "Compose_New2": {
          "type": "Compose",
          "inputs": "@contains(string(triggerOutputs()?['body']), item())",
          "runAfter": {
            "Compose_New_Item": [
              "Succeeded"
            ]
          }
        }
      },
      "runAfter": {
        "Send_an_HTTP_request_to_SharePoint": [
          "Succeeded"
        ]
      }
    }
  • linkgtaylor Profile Picture
    6 on at
    The first "Apply to each" outputs the Status and the second the Modified date
  • Mark Nanneman Profile Picture
    991 Moderator on at
    Can you show your "Select" action's mapping?
  • linkgtaylor Profile Picture
    6 on at
    {
      "type": "Select",
      "inputs": {
        "from": "@body('Filter_array')",
        "select": "@json(item())"
      },
      "runAfter": {
        "Filter_array": [
          "Succeeded"
        ]
      }
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 293

#2
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 223 Most Valuable Professional

Last 30 days Overall leaderboard