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:
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 ?
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:
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:
Set the Text property of the Label control to following formula:
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:
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 ?