cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Accessing current list item data in the OnVisible event of a SharePoint custom list form

I have created a custom form for a SharePoint list that lets the user enter a ZIP code in a field and then (through a Flow which calls a webservice) shows only the cities for that zip code in a dropdown list.

 

When I edit an existing item in my SharePoint list, in the custom form I need to access the item's ZIP code value in order to preload my dropdown list with the cities. So I tried these different techniques in the OnVisible event but none would work:

 

Set(dcv5;DataCardValue5.Text);;Set(ville;SharePointIntegration.Selected.ID);;Set(etabVille;First(Etablissements).scECTRAdrVille)

 

Each of these variables (DataCardValue5 is the data card containing the ZIP code) is displayed in a label on the list's form but they're empty except for the last one which always returns the city of the first item in the list (of course).

 

How can I access my current list item's data in the OnVisible event of the form ?

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Accessing current list item data in the OnVisible event of a SharePoint custom list form

Hi @R3dKap,

 

Could you please share a bit more about your SP list?

 

If you want to access your current list item data within the OnVisible property of the Integration FormScreen1, please take a try with the following formula:

SharePointIntegration.Selected.ColumnName

I assume there is a column called ZIP_code to store the ZIP code within your SP list, I have made a test on my side, please take a try with the following workaround:4.JPG

 

 

 

Set the Text property of the Label control to following formula:

SharePointIntegration.Selected.ZIP_code

Note: You should reference above formula within your app directly rather than initialize a global variable (Using Set function) to store the value. I have made a test on my side, if you initialize a global variable to store the value the above formula returns, the global variable would return empty.

 

Then save and publish your app, test it within your SP list.

 

The GIF image as below:Test1.gif

 

 

 

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Super User
Super User

Re: Accessing current list item data in the OnVisible event of a SharePoint custom list form

Hi @v-xida-msft,

 

Thanks for your example... In fact, my problem is elsewhere (or maybe I didn't explain it well enough).

 

As you can see in your GIF, when you select the first list item, once the form is displayed, the field and the label "ZIP Code" shows immediately 224000.

But when you select the 2nd item and click EDIT, the form pops-up but the field and the label show the value of the previous item (224000) for 1s and then it shows the value of the selected item (225600).

Same happens when you swith to the 3rd item: 225600 is shown for 1s and then 224100 is shown.

 

This latency is a real problem because when the OnVisible event of the screen is triggered, the SharePointIntegration.Selected.ZIPCode still has the value of the previous item (not the real selected one).

Same with the OnEdit event of the SharePointIntegration object.

 

Is there any way to trigger or do anything only when the "real good" data has been loaded ?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,586)