cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ejules
Level: Powered On

How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice field?

Hi Everybody,

 

I'm currently trying to simply set the Default value of a Dropdown in an Edit Form (Form is opened and the Dropdown should have a pre-selection). Even though I did extensive research I couldn't find a solution for a Sharepoint choice field (as I don't know how to find the ID's of those choices and how to reference it?

I have the DropDown with the Selections from Sharepoint ("Inland", "Ausland") and would like to be the Default for a blank form to be "Inland".

  PowerApps1.JPGPowerApps2.JPG

 

Thank you so much for your help.

 

Regards,

ejules

1 ACCEPTED SOLUTION

Accepted Solutions
NhungL
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

This is just to share that the formula below for the DataCard Default works for me:

 

LookUp(Choices('SPListName'.SPFieldName),Value="SpecificValue")

 

Remember to replace 'SPListName' and 'SPFieldName' with the actual SP List name and Field name, and "SpecificValue" with the choice value you would like to set as default.

 

 

27 REPLIES 27
Super User
Super User

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Hi @ejules

 

The Default is "Parent.Default"

- This is to append any existing data (if any) or blank if none.

 

However, if you wish to change, you need to select

- Advanced

- Unlock (you can see the icon, just click on it)

 

Then you may change the Default to:

- If(IsBlank(One of your datafield), "Inland", Parent.Default)

 

In this case, when you are

- Add a new item, most of the TextInput will be BLANK (but not default value such as createddate, Auto-ID,..), so it will detect that this is a NEW record and will set the Dropdown1.Default = "Inland".

 

If you are unsure of the items, you may use:

- First(YourDropDown).

 

Hope this helps.

hpkeong
ejules
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Hi @hpkeong,

 

Thank you very much for your response. Unfortunately I still get an error:

powerapps

Error Reads: "Invalid Argument Type (Record). Expecting a Text Value instead.

I somehow seem to be unable to assign a "Text" directly as a Default to a DropDown. I believe it has to do with the fact that I would need to choose an Item of a list somehow?

For Example: If(IsBlank(Receipt_Location);Parent.Default;Parent.Default) works.

 

Thank you very much.

 

Best,

Julien

Super User
Super User

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Hi

 

IsBlank(...), would suggest to refer to other blank field, not itself.

I guess you got it right maybe because your current data contains Inland, which is ismilar to the first record of Dropdown.

Anyway, I will try to investigate if time allowed.

 

Happy coding.

hpkeong
DanielaH
Level 8

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Hi Julien (ejules),

 

You seem to have used semicolons in your If statement instead of commas. That may have caused the error?

 

 

 

sruble
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

I have the exact same scenario as ejules and I'm running into the same issue.  I also confirmed that I'm using commas and not semi colons.  I have a Choice field from SharePoint called "Feedback Type".  It has 5 values and I want to set the default to "Documentation".

 

Within the Advanced pane, I put the following italics code in the Default field for the DataField named "Feedback_x0020_Type".

 

Code:

If(IsBlank("Feedback_x0020_Type"), "Documentation", Parent.Default)

 

The error I'm getting is the following:

Invalid argument type (Record).  Expecting a Text value instead.

 

Any thoughts on what the problem could be?

 

Thanks,

Scott

AlexN
Level 8

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

I think the root problem is that the dropdown values are not populated until you click on the dropdown. Therefor there simply isn't any default value which could be selected by the system.

sruble
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Is there any way to hardcode a value to set the default?  I was able to do this with a Boolean fields; e.g. by setting Default = true but not choice fields.

 

Thanks,

Scott

Highlighted
Sienna
Level 10

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

If you got table with name "Test" linked to your DropDown with Items set to Name which looks like this..

 

ID    Name

1     Selection1

2     Selection2

 

Then in your Default property of DropDown write simple

 

LookUp(Test, ID=2,Name)

 

Then the default value in your dropdown will be "Selection2"

Or closer to your situation if you want to check if collection is empty then set the default property to

 

If(IsEmpty(CollectionName), LookUp(Test,ID=1,Name), LookUp(Test,ID=2,Name)

 

Adjust it to your needs as you wish and it will work

 

sruble
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Sorry - I need a bit more guidance.  Ultimately, I just want to hard code the value "Documentation" as the default for a Choice field.

 

How and where do I create the table in the PowerApp?  I'm assuming this will just be a single row.

 

ID

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

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: 300 members 4,989 guests
Please welcome our newest community members: