cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MJGreyling
Helper III
Helper III

Refreshing form data

Good day,
I have a a gallery where a user selects an item. The OnSelect property of the button then Navigates to a form screen where some of the data in the form is prepopulated form the previous screen.

The user completes one entry and then the data is patched to sharepoint: Patch(CSNonMovingParts, LookUp(CSNonMovingParts, Title=DataCardValue28.Text), {SVO: DataCardValue1.Text, 'Requested by': User().Email, 'Requested on': Now(), Status: "Requested"})

However, I am adding the user name and the date the form was submitted to sharepoint. What I'd like to see is that the form is refreshed and that the two fields REQUESTED BY and REQUESTED ON now contain data and that the field STATUS now say REQUESTED and not AVAILABLE .

MJGreyling_0-1631499966372.png

 

 

U have tried everything I could find that was suggested including setting the OnSuccess property of the edit form to REFRESH(SHAREPOINTLIST NAME) but it doesn't work.

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

@MJGreyling ,

That is because you are setting the variable as a record, not a single value. This is not difficult (in fact very basic) to fix - try this OnSuccess

Set(selectID,Self.LastSubmit)

 and the form Item

LookUp(
   CSNonMovingParts,
   ID = selectId.ID
)

 

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.

View solution in original post

13 REPLIES 13
Digital
Super User
Super User

What is in the Items property of your form? 

 

Try putting a lookup to the datasource in the items property of your form so it is always looking up the latest record.

 

For example:

 

LookUp(CSNonMovingParts, ID=varSelectedID)

 

Where varSelectedID is the ID of the currently selected record. You can set this in the Gallery OnSelect.

 

 

The Item property of the form has: selectedId in. This I had to do to get the form to populate the data coming from the gallery.

I thought if I took your suggestion and put it in the OnSuccess Property it would work BUT i get Incompatible types: (It does the same if I do it in the ITEM property)

MJGreyling_0-1631502182200.png

 

Digital
Super User
Super User

You could try setting a variable in the gallery on select e.g.

 

Set(varSelectedItem,ThisItem)

 

Then in the Form's OnSuccess

 

Set(varSelectedItem,Form1.LastSubmit)

 

In the OnSelect property of the Gallery the variable selectId was already set:

Navigate(Screen1, ScreenTransition.Fade); Set(selectedId, ThisItem)

 

So in the OnSucces property of the Form I have:

Set(selectedId,EditForm3.LastSubmit)

 
still doesn't refresh the form data. 

Digital
Super User
Super User

In OnSuccess try looking up the submitted record in the datasource...

 

Set(selectedId,LookUp(YourSPL,ID = EditForm3.LastSubmit.ID))

 

Lol. I am realy thinking this is impossible to do.
No, didn't work. The record updates in SP but not on the form.

Set(selectedId,LookUp(CSNonMovingParts,ID = EditForm3.LastSubmit.ID))

 

Hi @MJGreyling ,

@Digital is on the right track, but the critical item which you have not included is the Item of the Form.

If you have the OnSuccess as 

Set(selectedId,Self.LastSubmit.ID)

and the Item of the Form

LookUp(
   CSNonMovingParts,
   ID = selectedId
)

it will display the record in its current state after the form submission.

 

Set(selectedId, Self.LastSubmit.ID)

So for the above I get an incompatible type error from the formula

And the same for this:

LookUp(CSNonMovingParts,ID = selectedId)

@MJGreyling ,

That is probably because you have selectedId defined elsewhere is a Record - forget about that one and use this

OnSuccess 

Set(gblID,Self.LastSubmit.ID)

and the Item of the Form

LookUp(
   CSNonMovingParts,
   ID = gblID
)

It has to work - I use it on many of my forms to show new records immediately after creation in edit or view mode on the same form.

 

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.

 

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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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