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

Screen transition, set for mode and grab record

Hi,

 

What would be the most efficient/technically correct way to build the following scenario please?

 

From a gal1(reading SharePoint list), click EDIT button.

 

On click of edit button, screen transitions to form1, form1 set to edit mode and populated with the data from SharePoint row, ready for updating.

 

Happy to receive the logic/steps and I'll attempt to figure out the answer/functions/scripture involved as it'll help me learn it further.

 

Many thanks!

4 REPLIES 4
Connor551
Resolver I
Resolver I

You'll need to apply this to your specific scenario, but in general there are two approaches.

 

You can either add a global variable on the OnSelect of the gallery:

 

Set(varSelectedItem, ThisItem)

 

Or, you can just reference the selected item (record) from the Gallery

Gallery.Selected

 

I would recommend the variable approach.

 

On your form, you would use the references above to specify the record the form should display.

 

I think, (I don't use forms often) the expression in the form would be:

 

varSelectedItem

 

Or

 

Gallery.Selected

 

Hope this helps 🙂 

 

Thank you for the response!

 

I have attempted to implement however so far have been unable to load the gallery item into the edit form, using the variable method.

 

My setup is as follows;

 

Gal1 - Edit Button on row

OnSelect - ResetForm(frm_EditBooking);Set(var_BookedDate,ThisItem.BookingID); Navigate(scn_Booking,ScreenTransition.Fade)

 

EditScreen/Editbooking form 

Items - First(Filter(RMOfficeBookerList, BookingID = var_BookedDate))

 

I have also tried to set the above to the specific dropdown field within the form however I still have the same result;

 

Editbooking form/Dropdown1

Items - First(Filter(RMOfficeBookerList, BookingID = var_BookedDate))

 

 

Result - The Editform does not bring back any values within the respective fields, it appears to be in the default state of Form.New

 

Editform default mode = Edit

@Preachman85 ,

The most reliable way I have found (which also presents the actual record, not a copy of it) to the SubmitForm() function is as follows. OnSelect of the Gallery

  Set(var_ID,ThisItem.ID);
  EditForm(frm_EditBooking);
  Navigate(scn_Booking,ScreenTransition.Fade)

The Item of the Form

Lookup(
   RMOfficeBookerList, 
   ID=varID
)

 

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.

Hi @Preachman85 

When navigating from within a gallery to an edit form place an icon in the gallery, OnSelect of icon

EditForm(Form1);Navigate(scrEdit,None,{var:ThisItem})

In this formula, var is the record being selected.

In Datasource of target edit form: YourspList 

In Item property of target form: Lookup(Yoursplist, ID = var.ID)

  1. Always set the mode of the target Edit form from the source before navigating to it. 
  2. Navigate() has an optional third element to carry over the record 
  3. The datasource property in the target should match the datasource in the Item property (I prefer to be very specific and use ID as this is a unique value in every record.

When creating a new record, use an icon outside of the gallery and set it's OnSelect property

NewForm(Form1); Navigate(scrEdit,None)

The mode of the target form is set by NewForm() and there is no need for the third optional element of the Navigation function as the record doesn't exist until it is saved.  The Item property of the target form is ignored when a new record is created. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,851)