cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ejules
Advocate I
Advocate I

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

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.

 

 

View solution in original post

76 REPLIES 76
hpkeong
Community Champion
Community Champion

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

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

hpkeong
Community Champion
Community Champion

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
Anonymous
Not applicable

Hi Julien (ejules),

 

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

 

 

 

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

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.

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

Sienna
Resident Rockstar
Resident Rockstar

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

 

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,658)