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 Apps / Patch Name from Dropdown
Power Apps
Answered

Patch Name from Dropdown

(0) ShareShare
ReportReport
Posted on by 18

Hello all, 

I'm new here and new to Power Apps and need some help please. I've searched the forms but haven't been able to find the fix yet...

 

Configuration: Select a record from the main screen; using "Collect" to save the record -> Navigate sends user to Action Screen -> User selects a name from the dropdown (from "Profile" list) -> User clicks a button to update the name in the "Main Data" list to the name selected in the dropdown. I'm using a separate "Profile" list due to my main data list being > 30k records.

 

Dropdown (working correctly): Distinct(Sort('Profiles',Name.DisplayName,Ascending),Name.DisplayName)

Update Button (Not working): ForAll(Collect_List1,Patch('Main Data',ThisRecord,{'Assigned To': Dropdown1.Selected.Result}))

 

Error: The type of this argument 'Assigned To' does not match the expected type 'Record'. Found type 'Text'.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @GAM1741 

    Welcome to the forum and to PowerApps!!

     

    First thing to understand... your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not.  ForAll is a function that returns a table of records based on your iteration table and record schema.

    It is more efficient to use the function as intended and will provide better performance, especially with a Patch function!!

     

    Your issue is that you are trying to set a User column with text.  You need to provide a full SharePoint user record (I assume you are using SharePoint).

     

    However, you will need more than just a name.  You will need the email of the user.  Does your Profiles list have emails as well?

     

     

     

  • SebS Profile Picture
    4,616 Moderator on at

    Hello,

     

    Try to use Dropdown1.SelectedText.DisplayName or Name of the column You want to patch result off.

     

     

    Hope it helps

    Regards

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @SebS 

    Keep in mind that SelectedText is a deprecated property!

  • SebS Profile Picture
    4,616 Moderator on at

    You are Right, never thought about it. Thank You.

     

     

  • GAM1741 Profile Picture
    18 on at

    Hi Randy, 

    Correct, I am using SharePoint. My Profile list requires users to select their name/email from the company directory but it doesn't have a separate column for the email specifically; only a column for the display name. The Main Data list Assign To column is also populated with the display name from the company directory. 

     

    I'll need to research the "ForAll" formula being backwards. I pulled this from a different forum and did get it to work with a combo box, but not with a dropdown.

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @GAM1741 

    First, ForAll can be "forced" to work kind of like a For Loop, but that is not what it was designed for and forcing it to do something is was not made for causes a nightmare for performance in your app.  

     

    Next, if Assigned To is a Person Column in your list, then again, you need to provide a SharePoint user record for it.

    I will assume that it is a Person Column and that you only have a display name to work from (as supplied from the Profiles list).

     

    Therefore, your formula would be:

    With({_userRecord:
     With(First(Office365Users.SearchUserV2({searchTerm: Dropdown1.Selected.Result, top:1}).value),
     {Claims:"i:0#.f|membership|" & Lower(Mail), 
     Department:"", 
     DisplayName: DisplayName, 
     Email: Mail, 
     JobTitle: "", 
     Picture: ""
     }
     )
     },
     Patch('Main Data',
     ForAll(Collect_List1,
     {ID: ID, 
     'Assigned To': _userRecord
     }
     )
     )
    )

     

    In the above, the Office365Users connector is used to lookup the Office 365 user record of the person selected in the dropdown.

    That information is then used to build a SharePoint user record.

    And finally, that is patched to all the records in the table (created by ForAll) to change the Assigned To column.

  • GAM1741 Profile Picture
    18 on at

    I added the Outlook365 connector and formula exactly as written but it's returning the error "SearchUserV2 is an unknown or unsupported function in namespace 'Office365Users'"

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @GAM1741 

    Check your spelling perhaps??  SearchUserV2 is an absolutely valid action on the Office365Users connector.

     

  • GAM1741 Profile Picture
    18 on at

    Thanks for your assistance Randy! I has the wrong office connecter selected but it's working correctly now. Very much appreciated! 

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard