cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Powertron
Helper I
Helper I

Status Field not populating on Form Load

Hi all,

 

I have a Powerapps form with a "Status" field, this field has 5 values as linked from a Sharepoint choice field in a list which is linked to the form.  If I set the field to Editable I can correctly manually select all the choices, so I know the linkage is working.  I have the following code set in "Default" status of the field : 

 

 

If(
   Request.Mode = FormMode.New, 
   {Value: New},
   {Value: ThisItem.Status}
)

 

Despite this on loading the app the field remains empty.  

 

Any ideas what I'm doing wrong?  Quite new to PowerApps so likely something stupid I've missed.

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Powertron ,

If that is a Combo Box, your code needs to be in the DefaultSelectedItems, not the Default.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

5 REPLIES 5
AmDev
Super User
Super User

Hi @Powertron 

 

Assuming this is the 'Default' property in the datacard for your status field and your Form is called 'Request' - Also, for a new form, you want the Status to = "New".

 

If my understanding is correct, please try with the following tweak to add " around your New text. This ensures Power Apps reads it as text.

 

If(
   Request.Mode = FormMode.New, 
   {Value: "New"},
   {Value: ThisItem.Status}
)

 

Hope this helps

 

WarrenBelz
Super User
Super User

Hi @Powertron ,

If that is a Combo Box, your code needs to be in the DefaultSelectedItems, not the Default.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi,

 

I have changed the code to what you've said, however the box remains the same, i.e no value on load.

 

The code indicates there are no issues but when opening the form in newform mode the box has no value.

 

Thanks,

 

Fraser

Hi @Powertron ,

Assuming

  • Request is the name of the Form this Combo Box is contained in
  • The Item of this Combo Box would be Choices(YourListName.Status)

That code looks correct to me. Are either of these untrue ?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz ,

 

I don't see any option for DefaultSelectedItems in my combobox Advanced properties, however on some digging around the place I found this under the DataCardValue value section of this drop down box.  With the change from @AmDev above applied to the code in this box this is now working fine.  Thanks both.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,905)