cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Florian_Klug
Frequent Visitor

prefilled logged in user

hey guys,

i created a holiday request. It works fine, but i want to take the next step...

The fields are based on sharepoint list. The column "proposer" is defined as person/group. Is it possible to prefill the field "proposer" in power apps? At this time it´s only possible to search your own name in this field.

I am grateful for every tip.

Florian  

1 ACCEPTED SOLUTION

Accepted Solutions

First you need to choose the App in the left side menu, then OnStart, and put the Set _CurrentUser code there. Then click on the Dropdown, and in the Items, put _CurrentUser

 

App_OnStart.png

 

Dropdown_Items.png

View solution in original post

13 REPLIES 13
abrae005
Kudo Collector
Kudo Collector

Hi @Florian_Klug ,

 

In your App's "OnStart", add 

Set(_CurrentUser, User())

 

Then you can use _CurrentUser.Email or _CurrentUser.FullName as the default text in your searchbox. 

thanks for your advice.

But there is no "on start"... see attachment

Anmerkung 2020-08-27 203445.jpg

 

 

You're almost there. The App OnStart function is actually chosen from the top-most item in your tree view, titled App, then OnStart will be selectable. In your screenshot, it looks like you have a control selected, which is why you can't see OnStart. See my screenshot below. Hope that helps!

2020-08-27 14_54_25-Copywriting_Intake_Form - Saved (Unpublished) - Power Apps and 1 more page - Wor.png

First you need to choose the App in the left side menu, then OnStart, and put the Set _CurrentUser code there. Then click on the Dropdown, and in the Items, put _CurrentUser

 

App_OnStart.png

 

Dropdown_Items.png

Perfect! I got it.

I have to click on it and then there is the current logged in user 🙂

Is there any way that you don´t have to click on it?

 

I think if you set the Dropdown's "Items" property, as well as the "Default" property, then it should auto-fill the dropdown. When I did the sample I screenshotted, I only set the "Items" property, and it autofilled my name into the dropdown when I started the app.

 

(Also, hat tip to @DDCJOEE who posted at basically the same time I did with the info about the App's "OnStart" function.)

It works. 🙂 Thanks for your help!

Florian_Klug
Frequent Visitor

Prefilled function with the proposer works fine now in power apps.

But when i start a workflow with power automate i don´t get back the proposer´s mail adress or name. The field is empty in sharepoint list. How can i transfer this value to sharepoint?

 

 

It sounds like your "Submit" button on your PowerApp isn't capturing the data from the User field. 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,268)