cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
viciouschloe
Level: Power Up

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

I figured it out.  Rather than using 0 for the index, I needed to set the index to the corrisponding default I wanted.  IE, the text value of my default was not at index 0.  I was another value.   Once I set that properly it works!  This SHOULD be eaiser though.....

TonyCosentino
Level: Power Up

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

How would this be done for Parent.Default value on a Date field? So the property is DataCardValue1.DefaultDate. I want to manually put a date in this field, but when I do, the value does not get saved back to the sharepoint list.

viciouschloe
Level: Power Up

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

I'm not sure.  That sounds like a different problem.  This solution is when you are using a field from SP that is a drop down list of items from another list.  Your situation seems to be a standard date field valided by the SP control.  So, there is no index of items really.  I bet it is just the format of the date you are using.  Not sure.  Did you try different date formats?

kagoodm
Level: Powered On

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

I'm struggling a bit.

 

I have a choice field in my SP list with 2 values...Normal and Urgent.  I have the default set to Normal in SP.

 

I'm trying to use the code you guys have provided in my PowerApp but appear to be stuck.  A couple of the posts say to put it on the card and somewhere I read said to put it on the DefaultSelectedItems on the field itself.  Where is the correct location?  

 

Also, I put in the following and it keeps giving me a yellow triangle that there is an invalid argument type.

 

If( SharePointForm1.Mode = FormMode.New,
{'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id : 0,
Value: "Normal"},
ThisItem.ParentP)

 

Can someone break this formula down for me and explain what I should have where I have SharePointForm1 and FormMode?

skylitedave
Level 10

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

Put this in the Default of the datacard that holds the Combobox mapped top the choice field in SharePoint

 

If(SharePointForm1.Mode = FormMode.New,

   { '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id : 0,
    Value: "Normal"},
ThisItem.StatusP)

 

Put this in the Update of that same datacard

    Combobox.Selected        <----- where combobox is the name of the combobox control in that data card mapped to the SharePoint choice list

 

Put this in the DefaultSelectedItems of the Combobox control (use Default property if you are using a DropDown and NOT a combobox) in that data card

    Parent.Default

 

Let me know if this works

kagoodm
Level: Powered On

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

Thank you so much!!

 

I had to tweak what was in the Default of the card a bit, but I got it working...finally.

 

If(SharePointFormMode = "CreateForm",
{ '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id : 0,
Value: "Normal"},
ThisItem.Request_x0020_Priority)

 

I can't believe that Microsoft has made it SO difficult to just pull the default over from SharePoint on a single field.  Unbelievable!

TheBeanStalk
Level: Powered On

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

Thanks Jeff!  Works perfect

BigShotRob
Level: Powered On

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

Jeff, you're the man.

Anonymous
Not applicable

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

This works inside the PowerApps, but when I go actually create a new item, the field does not automatically generate what I set as the default.

Anonymous
Not applicable

Re: Ability to set a default value for a Sharepoint Choice field mapped to DataCard in a PowerApps F

The below suggestion won't work for combo box or data card default property. Pls place the code in default.selected.item . it will work. work for me  for a new form

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

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