Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

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

Posted on by 1,594

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 ?

Categories:
  • Karl Profile Picture
    Karl 10 on at
    Re: Accessing current list item data in the OnVisible event of a SharePoint custom list form

    Even OnChange events are not being fired when Selected item of SharepointIntegration is changed. I had to put the logic to Selected event of a DropDown to be able to intialize Items at all.

  • R3dKap Profile Picture
    R3dKap 1,594 on at
    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 ?

  • v-xida-msft Profile Picture
    v-xida-msft on at
    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

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard