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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update a Sharepoint Lo...
Power Apps
Unanswered

Update a Sharepoint Lookup Field in my Power App

(0) ShareShare
ReportReport
Posted on by 64

Hello everyone,

I'm trying to give users the opportunity to enter NEW values NOT present in a second list that populates a lookup field when they fill out a primary list.  

So there are two lists: the main list, which has a Lookup field inside it that links to the second list.Main list form is customized with powerapp.

Both of my sharepoint lists have been uploaded as data sources in the power app

 

This is the second  list

Immagine 2024-06-20 161600.jpg

 

This is the main list (where "Sede" Field is lookup type on the second list )

 

Immagine 2024-06-20 161639.jpg

So..when in main list I choose one "Sede" in my Combobox,  I see the values in second list

 

Immagine 2024-06-20 161744.jpg

Objective:

when the user chooses  "***NUOVA SEDE***" (a special value,  "new Location" in english ) , in the power app I bring up two new fields (Nuova Sede e Nuovo Indirizzo) where the user enters the values related to the new "SEDE" that he wants to insert in the second list (e.g.: "SEDE 3")  .

PS: Of course, I also created the corresponding support fields in the SharePoint main  list

 

Immagine 2024-06-20 162130.jpg

I customized the form in the power app and hooked a Flow to which I pass the new values entered by the user as parameters and so far everything is ok.  

Result : I have now a new SEDE in the second list !

Immagine 2024-06-20 162243.jpg

The flow is launched by the "Inserisci Sede" button and it also returns to me the ID of new record created (67)

What I can't do is  update the value of my Lookup "Sede" field in  my main list  with the new value inserted in the second list. (SEDE 3)

 

Here's the code I added to the button with which I first launch the flow that returns the ID of the new record created in the second list and then I retrieve this new record with a lookup on the second list where I search by ID.

I used 2 global variables (ID_NewRecordInSecondList and NEWSEDE_RECORD)

 

 

Set(
      ID_NewRecordInSecondList,
      'MYFLOW'.Run(DataCardValue_NuovaSede.Text,DataCardValue_NuovoIndirizzo.Text

);

Set(
       NEWSEDE_RECORD,
       LookUp('SEDE Service List',ID= Value(ID_NewRecordInSecondList.ID_NewSede))
)

 

Then i modified DefaultselectedItems of "SEDE" field (lookup field in the main list) to:

 

          DefaultselectedItems  = NEWSEDE_RECORD

 

 

BUT:

The field is blank...white..empty..

Immagine 2024-06-20 165658.jpg

 

If I add two simple labels and set their text to

NEWSEDE_RECORD.Title and NEWSEDE_RECORD.ID I see the values correctly "SEDE 3" and "67".
So I think the variable is ok!
 

What is the easiest way to change the value of a lookup field "at runtime?"

 

Thank you in advance

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @AndreaPRJ ,

    Firstly, if you also want to allow for existing values to be displayed

    {
     Value:
     Coalesce(
     ThisItem.Sede.Value,
     LookUp(
     'SEDE Service List',
     ID = Value(ID_NewRecordInSecondList)
     ).Title
     ),
     Id: 
     Coalesce(
     ThisItem.Sede.Id,
     Value(ID_NewRecordInSecondList)
     )
    }

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • AndreaPRJ Profile Picture
    64 on at

    Sorry @WarrenBelz  ,

     

    Thank you very much, but it does not works.

     

    The only difference now is this one: is not empty, but it does not show my NEW value...

     

    Immagine 2024-06-21 104318.jpg

    That lookup field doesn't update in any way, and I'm wondering if it can really be done or not at this point 😔

  • AndreaPRJ Profile Picture
    64 on at

    anyone who can help me please? Thank you

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard