I'm working with a list that has 30+ fields and I need to capture what fields have been updated and output it to another list or table. Using the Get changes for an item action, is it possible to output only the fields that have changed and their value?
My first thought was to loop on or filter the output of the Get changes action, then somehow get the associated field values.
The Get Changes for an item or file action that can be used to determine which column has changed.
There is a Has Column Changed dynamic content that returns true if the field was changed or false if the field did not change.
Ellis
Right, but retrieving the field values is what I'm looking for.
"Using the Get changes for an item action, is it possible to output only the fields that have changed and their value?"
My hope is to avoid creating a large condition or switch statement.
This is possible and I can offer an approach to the problem - though other contributors with more experience than I should be able offer something better and more refined. But the following should get you started.
If we start with a simple SharePoint list called Routing - I want to know when any of the column values are changed; I want to receive an email showing me a list of the the columns that were changed along with their new values:
If you have versioning enabled on the list, you can view an item's version history and see which columns were changed and what the new values are:
The version history can be accessed by right clicking an item and then selecting Version history.
If we could get access this version history via Power Automate, and access to just that subset of data as shown in the version history then our job is done and we will have what we need. But I haven't found a way to do this or it is likely that this is not currently possible with Power Automate?
For now I will have to try to do this manually, and I will post a possible approach to the issue in the next post.
See also: Get the changes made to SharePoint Items with Power Automate
Ellis
Here is a demo flow along with some description of how it works. If you are able to get it to work, you can refine and merge a number of steps. Unfortunately it looks more complicated than it really is. The flow could work with almost any list.
If we start with a simple SharePoint list called Routing - I want to know when any of the column values are changed; I want to receive an email showing me a list of the the columns that were changed along with their new values. In the example below, the Folder and Preference column have been changed for item ID 14 and I receive an email with the changes that were made:
What I am trying to do is create an array that stores the SharePoint column names and a true/false value indicating if that column was changed or not. The array can be iterated over i.e. accessing each element of the array one by one. The array could be a JSON array but for simplicity I am going to use an array of strings:
Here is the high-level view of the flow:
Part 1: The trigger and get changes action:
Initialise an array variable varListOfColumnsChanged - which will store the SharePoint column names and whether the columns were changed or not (true or false):
We can get a list of all the columns and their changed states from the action Get changes for an item or a file (properties only). This data is given to us as a JSON object from the dynamic content ColumnHasChanged. I convert ColumnHasChanged to a string and store it in varStringData.
Split varStringData string at the comma delimiter ',' - creating an array as you see above, in the Compose Split String at comma action.
outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged']
outputs('ColumnHasChanged_as_JSON_Object_Data')
split(variables('varStringData'),',')
Part 2: After the split action we need to clean up the column names in the array by removing escaped strings (eg. " double-quotes got replaced with \" when the JSON object was converted to string) as well as removing other unwanted characters such as the '{' and '}' characters. The high level view of this section is shown below:
The escaped strings \" are removed along with { and } characters as you see above in the green box.
replace(items('Apply_to_each'),'"','')
replace(replace(outputs('Sanitise_Item_Step_1'),'{',''),'}','')
A little more tidy up to separate the SharePoint column name and its change state value using split:
The split expression is:
split(outputs('Sanitise_Item_Step_2'),':')
The expression for Append to array variable varListOfColumnsChanged is:
first(outputs('Compose_Split_on_Colon'))
last(outputs('Compose_Split_on_Colon')
Note the colon between the two expressions:
Part 3: Finally we check the SharePoint column name (key) and its change state value, and if it was changed, we store this column name in a variable - which I will use to email a list of all the changed columns. The high level view of this section is shown below:
Example of the output that was generated:
The flow could work with almost any list, you would just need to change the List/Library names. In the example below I connected the flow to an Issue tracker SharePoint list:
I get the following results, though you will need to handle the the values in complex columns:
Hope this helps.
Ellis
outstanding post! thank you for taking the time to write all of this up.
I was able to finally refactor the flow to fewer steps. This makes the flow shorter and easier to understand. All credit to Identify which SharePoint item columns were updated in Power Automate by Tom Riha.
(1) Add the trigger and Get changes actions:
(2) Initialise a string variable for the email body:
(3) Convert the object HasColumnChanged to string, and split at the comma delimiter. We filter only the items that contain string ':true'
From:
split(string(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged']),',')
item()
contains
string(':true')
Sample output:
(3) Use json() to do all the clean-up! From "\"Title":true" to "Title" using json(item()):
Sample output:
(4) Constructs the email body containing the changed columns and their values:
body('Select')
item(): triggerBody()[item()]
Sample output:
Ellis
While this works great, it fails when a field is empty
Hi @msabau ,
At what point in the flow does it fail? We may be able to adjust the expressions to handle missing values.
Ellis
Solved it by following the guide you linked above. The only problem is that that tutorial gets rid of the values. For the moment I don't need them, but if i'll ever need to know the values that were changed, I'll try to figure it out on my own
Basically this is the error:
InvalidTemplate. Unable to process template language expressions in action 'Append_to_string_variable_2' inputs at line '0' and column '0': 'The template language expression 'triggerBody()[item()]' cannot be evaluated because property 'Email' doesn't exist, available properties are 'Ottienielemento_ID'. Please see https://aka.ms/logicexpressions for usage details.'.
It happens when I try to use triggerbody to append the value of the field to the string.
Not really sure how to fix it at the moment.
EDIT: I guess this happens because my trigger is a button in a powerapp, not the same trigger as your guide. I'll try fix it now
Hi @msabau .
Here is something to try. If you update the expression in question (step 4) to the following:
Old: triggerBody()[item()]
Updated: triggerBody()?[item()]
when the property is not found, a null value (empty) should be returned, and the flow should continue. For more info, see How to query JSON data using JSON notation with Power Automate❔❔❓
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Thank you for your reply. With the updated expression the flow doesn't stop, but it doesn't display values
Yes, because the expression triggerBody()?[item()] is evaluating to null or empty. This means that the property triggerBody()?['Email'] does not exist in the triggerBody().
Check your data for the correct property name.
Example, triggerBody()?['Author']:
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|ellis.karim@dev365.com",
"DisplayName": "Ellis Karim",
"Email": "ellis.karim@dev365.com",
"Department": null,
"JobTitle": "Business Manager"
}
triggerBody()?['Author/Email']:
ellis.karim@dev365.com
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Thank you for your reply. I'm wondering if there is a way to cycle through all the properties so that I don't have to type them all manually
I finally figured it out. Thank you for your tremendous help
If anybody else has the same issue I had or just want to greatly simplify the flow, instead of Sanitising the JSON, you could just do this:
I recently had a very similar issue, and wanted to share a quick fix that I found:
I have two nearly identical lists with very different purposes and contain product information. However my users are used to populating one of the lists and not the second. I need the first list to populate the second list with user changes, or keep the value from the second list.
Trigger: When an item is created or modified - List 1
Get Changes for an item or file (properties only)
Get items - List 2: filter query - Product Sku (List 2) eq 'Product Sku' (List 1)
Apply to each (List 2 Value) (Update item - List 2)
in each column I used an if statement: if(equals(Has Column Changed: Product Description, 'true'), Product Description List-1, Product Description List-2).
Rinse and repeat for each of the columns that I need to have dynamically changed when a user updates a field.
Are you attending the Microsoft Power Platform Conference 2023 in Las Vegas? If so, we invite you to join us for the MPPC's Got Power Talent Show! Our talent show is more than a show—it's a grand celebration of connection, inspiration, and shared journeys. Through stories, skills, and collective experiences, we come together to uplift, inspire, and revel in the magic of our community's diverse talents. This year, our talent event promises to be an unforgettable experience, echoing louder and brighter than anything you've seen before. We're casting a wider net with three captivating categories: Demo Technical Solutions: Show us your Power Platform innovations, be it apps, flows, chatbots, websites or dashboards... Storytelling: Share tales of your journey with Power Platform. Hidden Talents: Unveil your creative side—be it dancing, singing, rapping, poetry, or comedy. Let your talent shine! Got That Special Spark? A Story That Demands to Be Heard? Your moment is now! Sign up to Showcase Your Brilliance: https://aka.ms/MPPCGotPowerSignUp Deadline for submissions: Thursday, Sept 28th How It Works: Submit this form to sign up: https://aka.ms/MPPCGotPowerSignUp We'll contact you if you're selected. Get ready to be onstage! The Spotlight is Yours: Each participant has 3-5 minutes to shine, with insightful commentary from our panel of judges. We’re not just giving you a stage; we’re handing you the platform to make your mark. Be the Story We Tell: Your talents and narratives will not just entertain but inspire, serving as the bedrock for our community’s future stories and successes. Celebration, Surprises, and Connections: As the curtain falls, the excitement continues! Await surprise awards and seize the chance to mingle with industry experts, Microsoft Power Platform leaders, and community luminaries. It's not just a show; it's an opportunity to forge connections and celebrate shared successes. Event Details: Date and Time: Wed Oct 4th, 6:30-9:00PM Location: MPPC23 at the MGM Grand, Las Vegas, NV, USA
The Reading Dynamics 365 and Power Platform User Group is a community-driven initiative that started in September 2022. It has quickly earned recognition for its enthusiastic leadership and resilience in the face of challenges. With a focus on promoting learning and networking among professionals in the Dynamics 365 and Power Platform ecosystem, the group has grown steadily and gained a reputation for its commitment to its members! The group, which had its inaugural event in January 2023 at the Microsoft UK Headquarters in Reading, has since organized three successful gatherings, including a recent social lunch. They maintain a regular schedule of four events per year, each attended by an average of 20-25 enthusiastic participants who enjoy engaging talks and, of course, pizza. The Reading User Group's presence is primarily spread through LinkedIn and Meetup, with the support of the wider community. This thriving community is managed by a dedicated team consisting of Fraser Dear, Tim Leung, and Andrew Bibby, who serves as the main point of contact for the UK Dynamics 365 and Power Platform User Groups. Andrew Bibby, an active figure in the Dynamics 365 and Power Platform community, nominated this group due to his admiration for the Reading UK User Group's efforts. He emphasized their remarkable enthusiasm and success in running the group, noting that they navigated challenges such as finding venues with resilience and smiles on their faces. Despite being a relatively new group with 20-30 members, they have managed to achieve high attendance at their meetings. The group's journey began when Fraser Dear moved to the Reading area and realized the absence of a user group catering to professionals in the Dynamics 365 and Power Platform space. He reached out to Andrew, who provided valuable guidance and support, allowing the Reading User Group to officially join the UK Dynamics 365 and Power Platform User Groups community. One of the group's notable achievements was overcoming the challenge of finding a suitable venue. Initially, their "home" was the Microsoft UK HQ in Reading. However, due to office closures, they had to seek a new location with limited time. Fortunately, a connection with Stephanie Stacey from Microsoft led them to Reading College and its Institute of Technology. The college generously offered them event space and support, forging a mutually beneficial partnership where the group promotes the Institute and encourages its members to support the next generation of IT professionals. With the dedication of its leadership team, the Reading Dynamics 365 and Power Platform User Group is poised to continue growing and thriving! Their story exemplifies the power of community-driven initiatives and the positive impact they can have on professional development and networking in the tech industry. As they move forward with their upcoming events and collaborations with Reading College, the group is likely to remain a valuable resource for professionals in the Reading area and beyond.
As the sun sets on the #SummerofSolutions Challenge, it's time to reflect and celebrate! The journey we embarked upon together was not just about providing answers – it was about fostering a sense of community, encouraging collaboration, and unlocking the true potential of the Power Platform tools. From the initial announcement to the final week's push, the Summer of Solutions Challenge has been a whirlwind of engagement and growth. It was a call to action for every member of our Power Platform community, urging them to contribute their expertise, engage in discussions, and elevate collective knowledge across the community as part of the low-code revolution. Reflecting on the Impact As the challenge ends, it's essential to reflect on the impact it’s had across our Power Platform communities: Community Resilience: The challenge demonstrated the resilience of our community. Despite geographical distances and diverse backgrounds, we came together to contribute, learn, and collaborate. This resilience is the cornerstone of our collective strength.Diverse Expertise: The solutions shared during the challenge underscore the incredible expertise within our community. From intricate technical insights to creative problem-solving, our members showcased their diverse skill sets, enhancing our community's depth.Shared Learning: Solutions spurred shared learning. They provided opportunities for members to grasp new concepts, expand their horizons, and uncover the Power Platform tools' untapped potential. This learning ripple effect will continue to shape our growth. Empowerment: Solutions empowered community members. They validated their knowledge, boosted their confidence, and highlighted their contributions. Each solution shared was a step towards personal and communal empowerment. We are proud and thankful as we conclude the Summer of Solutions Challenge. The challenge showed the potential of teamwork, the benefit of knowledge-sharing, and the resilience of our Power Platform community. The solutions offered by each member are more than just answers; they are the expression of our shared commitment to innovation, growth, and progress! Drum roll, Please... And now, without further ado, it's time to announce the winners who have risen above the rest in the Summer of Solutions Challenge! These are the top community users and Super Users who have not only earned recognition but have become beacons of inspiration for us all. Power Apps Community: Community User Winner: @SpongYe Super User Winner: Pending Acceptance Power Automate Community: Community User Winner: @trice602 Super User Winner: @Expiscornovus Power Virtual Agents Community: Community User Winner: Pending AcceptanceSuper User: Pending Acceptance Power Pages Community: Community User Winner: @OOlashyn Super User Winner: @ChristianAbata We are also pleased to announced two additional tickets that we are awarding to the Overall Top Solution providers in the following communities: Power Apps: @LaurensM Power Automate: @ManishSolanki Thank you for making this challenge a resounding success. Your participation has reaffirmed the strength of our community and the boundless potential that lies within each of us. Let's keep the spirit of collaboration alive as we continue on this incredible journey in Power Platform together.Winners, we will see you in Vegas! Every other amazing solutions superstar, we will see you in the Community!Congratulations, everyone!
Ayonija Shatakshi, a seasoned senior consultant at Improving, Ohio, is a passionate advocate for M365, SharePoint, Power Platform, and Azure, recognizing how they synergize to deliver top-notch solutions. Recently, we asked Ayonija to share her journey as a user group leader, shedding light on her motivations and the benefits she's reaped from her community involvement. Ayonija embarked on her role as a user group leader in December 2022, driven by a desire to explore how the community leveraged various Power Platform components. When she couldn't find a suitable local group, she decided to create one herself! Speaking about the impact of the community on her professional and personal growth, Ayonija says, "It's fascinating to witness how everyone navigates the world of Power Platform, dealing with license constraints and keeping up with new features. There's so much to learn from their experiences.: Her favorite aspect of being a user group leader is the opportunity to network and engage in face-to-face discussions with fellow enthusiasts, fostering deeper connections within the community. Offering advice to budding user group leaders, Ayonija emphasized the importance of communication and consistency, two pillars that sustain any successful community initiative. When asked why she encourages others to become user group leaders, Ayonija said, "Being part of a user group is one of the best ways to connect with experienced professionals in the same field and glean knowledge from them. If there isn't a local group, consider starting one; you'll soon find like-minded individuals." Her highlight from the past year as a user group leader was witnessing consistent growth within the group, a testament to the thriving community she has nurtured. Advocating for user group participation, Ayonija stated, "It's the fastest route to learning from the community, gaining insights, and staying updated on industry trends." Check out her group: Cleveland Power Platform User Group
Hear from Corporate Vice President for Microsoft Business Applications & Platform, Charles Lamanna, as he looks ahead to the second annual Microsoft Power Platform Conference from October 3rd-5th 2023 at the MGM Grand in Las Vegas.Have you got your tickets yet? Register today at www.powerplatformconf.com
We wanted to take the time to celebrate and welcome the new user groups that have joined our community. Along with that take a look at the event that might be happening near you or virtually. Please welcome: Biz Apps Community User Group - Power Platform Community (microsoft.com) This user group is dedicated for all community members of all skill levels to learn how to get the most out of their community experience. East Michigan Power Platform User Group - Power Platform Community (microsoft.com) This is hopefully the beginning of a community, covering eastern Michigan, built around the Power Platform. Biz Apps Community User Group This user group is dedicated for all community members of all skill levels to learn how to get the most out of their community experience. Events to checkout: In-Person: September 2023 Hybrid Philadelphia Dynamics 365 & Power Platform User Group MeetDynamics 365 and Power Platform Physical Meetup Hyderabad Power Platform User Group Meetup - Sept 2023 (In-Person)Manchester September 2023 In Person Meeting Virtual: Everything Dataverse, Do you know that Dataverse is more than just a Database!POWER PLATFORM MONTHLY DIGEST- SEPTEMBERBaltic Summit 2023PL-900 Power Platform Fundamentals TrainingHR and L&D transformation through Power PlatformDynamics 365 Marketing Experience User Groups - Use Cases and NetworkingPower Platform and Dual Write from Dynamics 365 F&O PerspectiveANZ D365 FinOps Team September 2023 meetup
User | Count |
---|---|
66 | |
33 | |
30 | |
28 | |
24 |
User | Count |
---|---|
86 | |
81 | |
56 | |
51 | |
50 |