Skip to main content

Notifications

Power Platform Community / Forums / Building Power Apps / Patch Sharepoint looku...
Building Power Apps
Suggested answer

Patch Sharepoint lookup column coming from a cascading dropdown

Posted on by 153
Dear all, I face the following issue:
 
I have two sharepoint lookup columns "Raum" and "Lagerort" in list "GefStoffVz PLA-AT-LEV". "Raum" looks up to a single choice column in a list "GefStoffVz PLA-AT-LEV Räume", "Lagerort" looks up to a single choice column PlaceSrc in the list "GefStoffVz PLA-AT-LEV Lagerorte".
 
List GefStoffVz PLA-AT-LEV Lagerorte additionally has a column "RoomRef" which assignes rooms from list "GefStoffVz PLA-AT-LEV Räume" to the "PlaseSrc" column
 
I use modern dropdowns in both cases.
 
Raum_drp
 
Defaultselecteditems: varThisItem.Raum
Items: Choices('GefStoffVz PLA-AT-LEV'.Raum)
 
Lagerort_drp
 
Defaultselecteditems: varThisItem.Lagerort
 
Items:
 
Filter(
    'GefStoffVz PLA-AT-LEV Lagerorte',
    RoomRef.Value = Raum_drp.Selected.Value
).PlaceSrc
 
Patching those columns with following code:
 
Patch (
    'GefStoffVz PLA-AT-LEV',
    LookUp(
        'GefStoffVz PLA-AT-LEV',
        ID = varSelectedListItemID
    ),
    {
        Raum: Raum_drp.Selected,
        Lagerort:Lagerort_drp.Selected,
       
    }
)
 
When I try to patch those two columns as above, column "Rooms" gets patched ok.
 
For column "Places" I get an error saying that the type record does not match the given type text. How do  I need to change that patch code to make it work?
 
Thanks a lot...
  • Nuriel Profile Picture
    Nuriel 153 on at
    Patch Sharepoint lookup column coming from a cascading dropdown
    @CA1105:
     
    I tried this, with same result, however it brought me closer to the solution. Thank you! I have realized that the ID I was missing here was that in the lookup list.
     
    Thus I tried around and also took another look on a solution I use for the double multiple choice cascaded lookup I use elsewhere (thanks to @WarrenBelz for that one).
     
    So I combined those until I came up with the following:
     
     
    A little bit clumsy, but it worked now :))
     
    And @FLMike: you were right, it only worked after I removed the .PlaceSrc in the items section!
     
    Thanks again for the combined effort!!!
  • Suggested answer
    CA1105 Profile Picture
    CA1105 182 on at
    Patch Sharepoint lookup column coming from a cascading dropdown
    Can you try something like below for your errored column?
     
    Patch (
        'GefStoffVz PLA-AT-LEV',
        LookUp(
            'GefStoffVz PLA-AT-LEV',
            ID = varSelectedListItemID
        ),
        {
            Lagerort: Lookup(
        'GefStoffVz PLA-AT-LEV Lagerorte',
        ID = Lagerort_drp.Selected.Id
    )
           
        }
    )
     
    
    
    
     
  • Nuriel Profile Picture
    Nuriel 153 on at
    Patch Sharepoint lookup column coming from a cascading dropdown
    Hello @FLMike,
     
    thank you for your suggestion, I originally simplified the code and removed the original names, because I thought it would make it easier:
     
    I will try to explain better and will use the actual screenshot now with an error and original names and variables I use (I have edited the original post correspondingly):
     
    This is the error I am getting when using .Selected.PlaceSrc
     
     
    This is the error I am getting when using .Selected.PlaceSrc
     
     
    As you see I have also tried using Place_drp.Selected, but it doesn't want to work either.
     
    The reason I am using Place_drp.Selected.PlaceSrc is because I grab only the value of the PlaceSrc column from the list I am looking the record up from. If I don't - I get all the columns into the combobox and it is supposed only to show the PlaceSrc values which correspond to preselected "Room" value which equal the "RoomRef" column value. But I have already tried all kinds of logical and unlogical combinations here, but can't figure it out.
     
    I am very.... confused, if it doesn't work as an error it shouldn't work at all, not simply partially patch, but you are saying it partially patches and that's not normal
     
    Sorry for the confusion, maybe I explained it wrongly. It's not any partial patching. It's just that I use a normal "Choice (List.column)" type of code to grab the items in case of the "Room" column, thus patching it as .Selected works here.
     
     
  • Suggested answer
    FLMike Profile Picture
    FLMike 26,162 on at
    Patch Sharepoint lookup column coming from a cascading dropdown
    Hi
     
    Please always make sure to show where the error is not just the words, its critical for us to help you. There is a reason it highlights the words, need share that too
     
    I am very.... confused, if it doesn't work as an error it shouldn't work at all, not simply partially patch, but you are saying it partially patches and that's not normal
     
    Why are you doing this
     
    Place:Place_drp.Selected.PlaceSrc
     
    instead of
     
    Place:Place_drp.Selected

    What you are doing is take the selected Record, that you want, and instead grabbing the Text PlaceSrc,
    which is why it says, Text to Record don't match. just use Selected

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,065

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,407

Leaderboard