cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft maruthi2513
Microsoft

Re: How to Default a People Picker to current user & save to SharePoint List source

Should I abandoned the SubmitForm function altogether and used Patch to create a record, manually referencing all the input fields for each corresponding property.

EdHacker
Level: Powered On

Re: How to Default a People Picker to current user & save to SharePoint List source

 

If you need to set a default value for a lookup field, currently your only choice is the Patch() function.

Microsoft maruthi2513
Microsoft

Re: How to Default a People Picker to current user & save to SharePoint List source

Thank you... While i am able to use the Patch() function  during Submit...

 

How do we Patch() a Dropdow to Show the Logged in user in the People Picker.

 

Ideally when the Screen Opens i want the Logged in User to be Auto Selected as Default in the People Picker

Anonymous
Not applicable

Re: How to Default a People Picker to current user & save to SharePoint List source

"Hybrid" approach might work? I think I got this to work once on a solution I was messing around with, but cannot remember for sure.

 

Create a form, but display only the person field on it. This will allow for the type-in + search functions that come with the form field (I haven't been able to recreate this manually so far).

 

However, instead of using submitForm() method, use Patch() and manually reference the selected value of the dropdown. You should be able to set the default property this way as well in theory, or just use the Default property of the form dropdown.

JacobSVVJC
Level: Powered On

Re: How to Default a People Picker to current user & save to SharePoint List source

So I have implemented your solution however I am getting an issue where the form will not submit with the auto-populated data. It makes the user erase their name and retype it so they can select from the drop down and then it will submit the form. Does that make sense? hoping you can help.

 

Ideally I would like to hide this field entirely so that it autopopulates without them even realizing it

Anonymous
Not applicable

Re: How to Default a People Picker to current user & save to SharePoint List source

Are you using the form Submit() function?

 

If I were you I would scratch that altogether and just use Patch() after automatically grabbing their details and setting that field with their name, etc

JacobSVVJC
Level: Powered On

Re: How to Default a People Picker to current user & save to SharePoint List source

I am using the Submit () so maybe that is the issue. I did see the Patch() function but I am not quite sure how to get that to still submit the entire form. Maybe I am just mistaken on how it actually functions.

 

As of now, I set it back to a state where it works as is but just requires the user to input their name themselves.

 

here are some screen shots so maybe you can help me write the Patch() function that I need.

 

App1.JPGApp2.JPGApp3.JPG

Anonymous
Not applicable

Re: How to Default a People Picker to current user & save to SharePoint List source

Yep, I came across the same bug the first time I used the Submit() function. Ditched it pretty quickly and I pretty much use Patch() everywhere now.

 

In your case, I would get rid of "submitted by" field (I'm assuming the person logged in will be the person submitting a ticket), instead you can get all their details using the User(). and Office365Users.MyProfile() properties.

 

You can keep the form there, and have a seperate submit button which fires off Patch(), manually referencing the values of the datacards in that form to submit the new item. There are plenty of code examples floating around for how to use the function, the official PowerApps Documentation is a good start. The code examples posted earlier in this thread should give a pretty good indication of how to set the Person field using the Patch() function.

 

For form input validation, use the button's Disabled property, checking the required input fields using the IsBlank() function.

JacobSVVJC
Level: Powered On

Re: How to Default a People Picker to current user & save to SharePoint List source

 

sorry for the late response - im pulling an all nighter for my company and nothing else to do but play with this 😛

 

I have the form now using the Patch function () instead of the SubmitForm. Now when clicking the button to submit I get an error - A value must be provided for item.

 

I have some hidden fields in the form that are holding default values that I am assuming the patch should take care of using the Defaults option with it.

 

Here is my OnSelect =

Patch('IT Support Requests',Defaults('IT Support Requests'),{Title: DataCardValue13, Issue_x0020_Category: DataCardValue8, Ticket_x0020_Details: DataCardValue15, Urgency: DataCardValue14, Submitted_x0020_By:{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims:"i:0#.f|membership|"&Lower(CurrentProfile.Mail), Department: CurrentProfile.Department, DisplayName: CurrentProfile.DisplayName, Email: CurrentProfile.Mail, JobTitle: CurrentProfile.JobTitle, Picture: User().Image}})

I also have the OnVisible =

UpdateContext({CurrentProfile: Office365Users.UserProfile(Office365Users.MyProfile().Id)})

 

 

Anonymous
Not applicable

Re: How to Default a People Picker to current user & save to SharePoint List source

So far, whenver I have used Patch I always need to provide values for any required fields. Probably the same case here.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,625)