cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
R3dKap
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
v-xida-msft
Community Support
Community Support

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.

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,574)