Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Default a Lookup Choice

(1) ShareShare
ReportReport
Posted on by 293
Good afternoon all,
 
I am having an issue trying to help someone with an app. They have a column on a Sharepoint list that is a lookup column and is used in multiple apps. In this app they want this column to default to one of the items, I have set the default selected items to the item and it defaults it when you open the app, however when you submit it submits it as blank, any help greatly received.
 
Thanks,
 
Edd
  • Michael E. Gernaey Profile Picture
    39,785 Super User 2025 Season 1 on at
    Default a Lookup Choice
     
    No, please do not do that. I'm sorry @BP-12121819-0 that is not something I recommend. I asked them already to add the label to check it. The reason for it being blank is a specific cause that I am trying to validate. But its not something you should add hidden controls for. If you had 50 of them and needed 50 hidden controls that is unwieldy.
     
    It is a pain why this happens but the solution, if its the problem is easier than that and should not happen but in certain circumstances.
     
    I am sorry, adding hidden controls is a nice, work around but I've never had to do it in thousands of customers across Microsoft. I just don't want to make that a standard but :-) please do what makes you feel best
     
    Again, my original ask was validate if its really blank. I am sure it is.
     
    It is better to force a reset of the control which will stop the issue than a hidden control :-) but hey :-) we all just want to help you, but my focus is helping in the right way not just a way.
     
  • Suggested answer
    BP-12121819-0 Profile Picture
    35 on at
    Default a Lookup Choice
    Edd, based on what I understand from your question, I believe this is something I experienced before as well.  In my case, I found that combo box controls will patch data back to a SharePoint List or Dataverse table without issue when creating a record.  However, when I updated the record through a Patch function for updating the record, I found that the default data in that combo box was patching a blank value back.  To troubleshoot why it was doing this, I created a text label to reference this Combo Box control and sure enough the text label was blank.  
     
    My solution for this, although not ideal, resolved the issue.  Instead of Patching straight from the Combo Box, I patch from a Text Label that is set to invisible and references the Combo Box.  In the Text Label control, I input the below formula in the Text property to first check if the Combo Box was blank, then refer to the existing record input.  If not blank, then populate the Text label with the selected item from the Combo Box.  I then updated my Patch function to write the Text Label back to the Dataverse table rather than the Combo Box control. 
     
    The formula below references three separate Dataverse tables (one for each region in the organization) so that the Text Label control populates with the data from the respective region's Dataverse table based on the "Log Number" selected in a separate Combo Box that is used to lookup a record and populate all the fields in the Canvas app (no use of Forms in this app).  The Log Number is a unique record ID I wrote into the Dataverse table that made more sense to the user than the GUID.  
     
    I'm fairly new to Power Apps, so I'm sure there's a better solution, but this has worked for me to resolve the issue with Combo Boxes returning blank values back to the SharePoint List/Dataverse table when updating a record.  
     
    If(lblRegionOutput.Text="1",If(IsBlank(cboLogSubtypeSel_5.Selected.field_1),LookUp(colExistingOneLogRecords,cr76c_logno=lblLogNoOutput.Text,cr76c_subtype),cboLogSubtypeSel_5.Selected.field_1),
        If(lblRegionOutput.Text="2",If(IsBlank(cboLogSubtypeSel_5.Selected.field_1),LookUp(colExistingTwoLogRecords,cr76c_logno=lblLogNoOutput.Text,cr76c_subtype),cboLogSubtypeSel_5.Selected.field_1),
        If(lblRegionOutput.Text="3",If(IsBlank(cboLogSubtypeSel_5.Selected.field_1),LookUp(colExistingThreeDOSLogRecords,cr76c_logno=lblLogNoOutput.Text,cr76c_subtype),cboLogSubtypeSel_5.Selected.field_1)
    )))
     
    cboLogSubtypeSel_5 = Combo Box where the subtype for an assignment is selected
    colExistingOneLogRecords = collection from Dataverse table
    cr76c_logno = Custom created unique record ID in the Dataverse table
    lblLogNoOutput = Text label based on a separate Combo Box control for selecting the custom unique record ID
     
    Hope this is helpful. 
     
  • ronaldwalcott Profile Picture
    2,443 on at
    Default a Lookup Choice
    When you say that you set it to the item did you lookup the linked record and set it to that?
  • Suggested answer
    Michael E. Gernaey Profile Picture
    39,785 Super User 2025 Season 1 on at
    Default a Lookup Choice
     
    What type of
     
    We would need to see the app and the apps expressions, Also please provide the cofiguration of the lookup itself and what column binds etc
     
    1. You say submit, like a form Submit or patch and what type of control a single select or multiple select combobox?
    2. take a look at the Update Property for that Forms DataCard, the issue would be there most likely
    3. Make sure that column isn't mark read only or anything weird
    4. Had a temporary label to the form, have its value set to the .. control so you can see if it really has a value or not (regardless of the default selected items)
     
    Cheers

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,518 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,756 Most Valuable Professional

Leaderboard