web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : kYw9sIcZ5cJv8SOp0Cpo5m
Power Apps - Building Power Apps
Answered

Update property of lookup column updating SharePoint list but not canvas app field

Like (0) ShareShare
ReportReport
Posted on 2 Aug 2021 21:59:20 by 160

I have two SharePoint lists: 

 

EmpDB (main data source) with look up fields Location, Location: STATE, Location: COUNTY

LUList (Location lookup source) with Title (Location), STATE, COUNTY

 

When I choose the Location in my canvas app, Location populates and Location:  STATE and Location: County auto-populate.  After I submit the form and go back into the item in the canvas app, Location is blank but the value did push to the SharePoint list.  Location: STATE and Location: County hold the values and pass to the SharePoint list but if I change the value of the Location, the Location: STATE and Location:  County do not change.  I have done a lot of research and cannot seem to come up with a solution.

 

The following are the location properties:

Location.Update:

If(
 !IsBlank(LULocationDataCardValue),
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Id: LULocationDataCardValue.Selected.Id,
 Value: LULocationDataCardValue.Selected.Value
 }
 )

 

Location.Items:

ShowColumns(
 AddColumns(
 GroupBy(
 Choices([@EmpDB].Location),
 "Value","Location"
 ), 
 "Id",First(Location).Id 
 ),
 "Value","Id" 
 )

 

Two questions:

1.  What should be in the Location.DefaultSelectedValue property or how can I get the selected value in the Location field to stay in the canvas app?

 

2.  How can I get the lookup fields based on Location to update OnChange of the Location field in the canvas app?

 

Thank you very much for your assistance in advance!

I have the same question (0)
  • GoGorilla Profile Picture
    160 on 03 Aug 2021 at 20:36:19
    Re: Update property of lookup column updating SharePoint list but not canvas app field

    @v-xiaochen-msft Thank you for your help.  Location works and stays populated in the canvas app.  For the Work States lookup column, I made it a text field and handled the lookup in PowerApps.  The user sometimes likes to edit in Grid View, so I was trying to make it easy on both sides. 

  • GoGorilla Profile Picture
    160 on 03 Aug 2021 at 15:41:18
    Re: Update property of lookup column updating SharePoint list but not canvas app field

    @v-xiaochen-msft  Thank you, that worked for the location value in the form but is there any way to do one or the other of the following:

    1.  update the Location:STATE field in form prior to submitting a second or third time if there happens to be an error and a change needs to be made? 

     

    2.  Otherwise, how can I Update another field in the SharePoint list called WorkStates that is a lookup column in SharePoint and it's value is based on what the LocationDataCardValue.Selected is.  It is not updating in the list but it is in the form. So the WorkStates.Update property is where I am having an issue. 

     

    See my code in WorkStates below:

     

    ddWorkStatesDataCardValue.Items:

     

    Distinct(
     Filter(
     Choices([@EmpDB].WorkStates),
     Value in Filter(
     'PSDR TAA Addresses', Title = LULocationDataCardValue.Selected.Value
     ).STATE
     ),
     Value
     ).Result

     

     

    ddWorkStatesDataCardValue.OnChange:

     

    Clear(colWorkState);
    ClearCollect (colWorkState,
    ddWorkStates.Selected)

     

    WorkStatesDataCard.Update:

     If(
     !IsBlank(LULocationDataCardValue),ForAll(
     colWorkState,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id: LookUp('PSDR TAA Addresses',STATE = Result).ID,
     Value: LookUp('PSDR TAA Addresses',STATE = Result).STATE
     }
     )
     )

     

    My colWorkStates has nothing in Results nor does it have an ID column.  It apparently is not working.  

     

    If I can get the Location:STATE to update in the form if LocationDataCardValue is changed, then that would be ideal.  It populates on the first change in a New form but not if the form is edited after submission.

     

    If not, how can I get the ddWorkState, which is a lookup column to the same lookup list (PSDR TAA Addresses) as Location but separate from location, e.g. WorkStates as opposed to Location:STATES.

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    on 03 Aug 2021 at 02:00:50
    Re: Update property of lookup column updating SharePoint list but not canvas app field

    Hi @GoGorilla ,

     

    What's the Default property of your datacard ?

    What's the DefaultSelectedItems property of the combo box control in your datacard ?

     

    I did a demo for you.

    1\ This is my list LUList .

    vxiaochenmsft_0-1627955290566.png

    2\ This is my list EmpDB.

    vxiaochenmsft_1-1627955401404.png

     

    3\ Add an edit form control 'Form1' and set its DataSource property to:

    EmpDB

     

    Set the form's Item proerty to:

    First(EmpDB)

    // I assume you want to modify the first item's value of Location column . So I set the form's Item property like this as an example.

     

    4\ Set the datacard's (Location_DataCard1) Default property to:

    ThisItem.Location

     

    5\ Set the combo box control (LULocationDataCardValue)'s Items proerty to:

    ShowColumns(AddColumns(GroupBy(Choices([@EmpDB].Location),"Value","Location"),"Id",First(Location).Id),"Value","Id")

    // Same as your formula

    vxiaochenmsft_2-1627955685213.png

     

    Set the combo box control's DefaultSelectedItems property to:

    Parent.Default

     

    6\ Set the datacard's (Location_DataCard1) Update property to:

    If(!IsBlank(LULocationDataCardValue),{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:LULocationDataCardValue.Selected.Id,Value:LULocationDataCardValue.Selected.Value})

    // Same as your formula

    vxiaochenmsft_3-1627955790416.png

     

    7\ When I change the combo box 's value and save it to sp list, the result is as follows:

    vxiaochenmsft_4-1627955839097.png

    vxiaochenmsft_5-1627955852973.png

    // The combo box's value did not change to blank.

     

    In addition, did you set a formula on Onsuccess property of your form?

    vxiaochenmsft_6-1627956018369.png

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

     

     

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete