cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Re: Set default selection for drop-down in a new Form

The person lookup is more complicated. This code would set the current user as the default value. The code would go into the parent data card of person field just like the other example.

 

If(Edit.Mode = New,     {
        '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:Concatenate("i:0#.f|membership|",Office365Users.Manager(User().Email).Mail),
        DisplayNameSmiley Surprisedffice365Users.Manager(User().Email).DisplayName,
        EmailSmiley Surprisedffice365Users.Manager(User().Email).Mail
    }, ThisItem.PersonField)



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

Thank you! Assigning a different user does work.

However, my question and example was about clearing a Person field and for some reason this doesn't work at all:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",Claims:"",Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""}

 

It fails on submitting a form.

If I replace Claims:"" with Claims:Blank() then it somewhat works (submits the form but doesn't clear Person field)

 

Super User
Super User

Re: Set default selection for drop-down in a new Form

Are you clearing the person from the Default value or are you doing this in a Patch function?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

Shortly, I'd like to have a functionality that allows me or a user to clear out a Person field by pressing a button or any other condition.

 

A specific example is what I have in my form. Depending on "Accepted" drop down selection, it either clears out a "Reason for decline" (if "Yes" is selected), OR it clears out "Priority" and "Assigned Engineer" (if "No" is selected) as I don't wanna keep all values in a SP list.

yes.png

no.png

Hopefully it makes sense.

Super User
Super User

Re: Set default selection for drop-down in a new Form

There is a function called Reset which will reset a control to its default property value.

 

Reset function in PowerApps



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

If I am correct, I don't think 'Reset' function is what I need as my form is already saved and my fields are populated in a SP list. (Let's say a manager changed his mind, decides to go back to that document/form, and selects "Not accepted" for that document).

 

Plus it's still kinda strange that with regular lookups I can use either "" (to nullify a lookup) or "some value" (to set a value for a lookup) but I cannot use "" when working with a Person lookup field.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 169 members 4,104 guests
Please welcome our newest community members: