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 / Person Field Value Is ...
Power Automate
Answered

Person Field Value Is Not Resilient?

(1) ShareShare
ReportReport
Posted on by 271
I'm working on an app that uses a collection to capture information, and then the whole collection is patched to a SharePoint list using a ForAll() function. I'm using a combo-box to search and select a person from our tenant Office365Users address book. That part works fine, and the Record value stores to the collection no problem. The issue is, if I re-open that item from the collection to edit a field, it will not let me save the item back to the collection without re-adding / selecting a person in the combo-box, even though it still shows the name of the person I selected the first time.
 
This is the saved gallery item:
 
 
If I reopen the item for edits, it shows the person whom I selected the first time, which indicates it's pulling the Record value from the collection just fine:
 
 
But if I make a change in any field (except the Requested For field) and then try to resave the item, the Save icon is completely non-responsive - UNLESS and UNTIL I clear the Requested For field and reselect a name, even it it's the same person I selected the first time. I don't understand why it's not "persisting".
 
This is the Items property of the combo-box field for the Requested For field:
 
Filter(
    Office365Users.SearchUserV2(
        {
            searchTerm: Trim(Self.SearchText),
            isSearchTermRequired: false
        }
    ).value,
    AccountEnabled = true && Not("#EXT" in UserPrincipalName)
)
 
 
This is the OnSelect property of the Save icon:
 
 
If(
    // Check if DateNeededBy is before today
    dp_DateNeededv2.SelectedDate < Today(),
    // Notify if date selected is before today
    Notify(
        "The Date Needed By cannot be prior to today.",
        NotificationType.Error
    ),
    // General required fields check
    IsBlank(inp_Itemv2.Text) || IsBlank(cb_UserSearch) || IsBlank(inp_Costv2.Text) || inp_Costv2.Text = "$0.00" || IsBlank(inp_QuantityTypev2.Selected.Value) || IsBlank(dp_DateNeededv2.SelectedDate),
    // Notify if general required fields are empty
    Notify(
        "All required fields must be filled.",
        NotificationType.Error
    ),
    UpdateContext(
        {
            AddressRequired: ckbx_DeliveryReqv2.Value,
            AddressWarning: ckbx_DeliveryReqv2.Value && (IsBlank(inp_StreetAddress1v2.Text) || IsBlank(inp_Cityv2.Text) || IsBlank(inp_Zipv2.Text)),
            NeedsSaving: true
        }
    ),
    // Handle address warning separately
    If(
        AddressWarning,
        // If address warning is true, show the popup and do not proceed
        Notify(
            "A delivery address must be provided.",
            NotificationType.Error
        ),
        // Otherwise, proceed with saving the item
// Fetch the selected user's UserPrincipalName
        UpdateContext({selectedUser: cb_UserSearch.Selected.UserPrincipalName});
        // Check if selectedUser is not blank
If(
            !IsBlank(selectedUser),
            // Use the Office365Users.ManagerV2 function to get the manager's details
            ClearCollect(
                managerDetails,
                Office365Users.ManagerV2(selectedUser)
            );
            // Patch the item to the collection with the manager's details
Patch(
                colItemsV2,
                ThisItem,
                {
                    Item: inp_Itemv2.Text,
                    RequestedFor: {
                        Claims: "i:0#.f|membership|" & cb_UserSearch.Selected.Mail,
                        Department: cb_UserSearch.Selected.Department,
                        DisplayName: cb_UserSearch.Selected.DisplayName,
                        Email: cb_UserSearch.Selected.Mail,
                        JobTitle: "",
                        Picture: ""
                    },
                    RequestedForDisplay: cb_UserSearch.Selected.DisplayName,
                    RequestorEmail: cb_UserSearch.Selected.Mail,
                    UserDisplayName: cb_UserSearch.Selected.DisplayName,
                    Cost: Value(inp_Costv2.Text),
                    Quantity: Value(inp_Quantityv2.Text),
                    QuantityType: inp_QuantityTypev2.Selected.Value,
                    DateNeeded: dp_DateNeededv2.SelectedDate,
                    DeliveryRequired: ckbx_DeliveryReqv2.Value,
                    ItemComments: inp_ItemComments.Text,
                    Source: inp_Sourcev2.Text,
                    SourceURL: inp_SourceURLv2.Text,
                    Subtotal: Value(inp_Costv2.Text) * Value(inp_Quantityv2.Text),
                    ShowSaveButtons: false,
                    Manager: If(
                        CountRows(managerDetails) > 0,
                        First(managerDetails).displayName,
                        "Manager not found"
                    ),
                    ManagerEmail: If(
                        CountRows(managerDetails) > 0,
                        First(managerDetails).mail,
                        ""
                    )
                }
            );
            // Update context variables that support Edit display and warning functions
UpdateContext({EditPressed: false});
            UpdateContext(
                {
                    NeedsSaving: false,
                    UnsavedChanges: false
                }
            );
        )
    )
);
//Reset(cb_UserSearch);
 
And this is what I have in the DefaultSelectedItems property for the Requested For combo-box:
 
LookUp(colItemsV2, UserDisplayName in UserDisplayName, [ThisItem.RequestedFor])
 
I don't have anything in the regular Default property.
 
Any ideas?
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    Hi
     
    So one thing to mention. While it seems like hey my DefaultSelectedItems etc are for sure working due to the collection.. Just because it looks like it does, doesn't mean it is.
     
    Meaning, there are scenarios, where you will see the value, yet it wasn't put there by the Collection/Source, it simply hadn't been reset yet.
     
    So I would repro, your steps, but before you actually remove/readd, stop the app and go to the Collections area and see if the persons value is really there.
     
    I haven't parsed your giant string of code, however you mentioned that it doesn't  "do" anything which then also means it didn't run (I don't think thats the case)
     
    Here is what I ask you to do please, so we can easily debug it.
     
    Go into your Button.
    Starting at the Top Add a lot of Trace() statements all the way done, so that when the code runs it will log each section of that button code it hits and will help us figure out why it did nothing
     
    After you add your Trace Statements, then publish your app. 
    Then (if you can repro your problem in the dev studio which is best), click the Stethescope, and run monitor (at the bottom).
    Start your app and go all the way until BEFORE you click the button (at the time you expect it to do nothing)
    Click back over to the monitor tab and Clear Data
    Then go back to your app and click the button
     
    When done, click back to the Monitor Tab, and in the Filter type Trace
    And see which ones get triggered.. and which ones don't so you can understand for sure which logic ran and then we can easily figure out why.
     
     
  • Verified answer
    MarcusD1 Profile Picture
    271 on at
    After learning how to use Trace() and the Monitor [the best thing to come out of this issue], I stumbled upon the solution. Short answer, I was using the wrong approach for the Items property of my Person picker combo-box.

    The code I should have been using was:
    Choices([@'Procurement Request Line Items'].'Requested For')
    vs. what I was using:
    Filter(
        Office365Users.SearchUserV2(
            {
                searchTerm: Trim(Self.SearchText),
                isSearchTermRequired: false
            }
        ).value,
        AccountEnabled = true && Not("#EXT" in UserPrincipalName)
    )

    Everything after that (the Default and DefaultSelectedItems properties) was straight forward at that point.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 582

#3
Haque Profile Picture

Haque 529

Last 30 days Overall leaderboard