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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup Field Default V...
Power Apps
Answered

Lookup Field Default Value Error

(2) ShareShare
ReportReport
Posted on by 704

Hello.  I'm facing an issue with setting the default value of a Lookup column.  My datasource is a SharePoint list.  I have a parent/child relationship between two lists.  For example, I have a "Projects" list and another "Time" list with a lookup column pointing to the Projects lists so you can put time in for a particular project.  On my New Form  for the Time List in PowerApps I want to auto-populate the Project Lookup column with the currently selected Project that I have as a global variable in PowerApps.  I thought I could do this by setting the Default Value of the Lookup Data Card to this:

{
'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: varWO,
Value: varWO
}

 

It looks like in the Preview it is setting the value correctly, however, when I submit no record is added to the list and I see an error that "A value must be provided for item".  

 

Has anyone else ran into this?  Is this a bug?  This project needs to be done by Friday morning and this is the last thing I have to do to get it done and I'm out of ideas.  I even tried just creating a single line of text field and trying to auto-populate that with my global variable.  That will create a record but with a blank column value. 

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

     

    Hi @aprildunnam,

     

    What is your current situation?

     

    The default value of the lookup should be configured as below:

     

    {
    '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: 'The corresponding Item ID of the Lookup list item',
    Value: 'The value of the Lookup list item'
    }

     I suspect the reminder should mention that the Id value is not within the available data range.

    Basically, Id field should be the corresponding Item ID of the value you would like to set, and the value property should be set to the data of the lookup field.

    The data would be saved successfully only when the Id and the Value matches to the same item of the lookup list item.

     

    Regards,

    Michael

     

  • aprildunnam Profile Picture
    704 on at

    Hello.  I am using the exact configuration you mentioned in the default value of the lookup.  In my SharePoint List the ID and Title are the same value.  I have a global variable in my PowerApp that is getting the ID for the lookup and I'm passing that in the default value logic.  I've verified that the value in my global variable matches the ID and Title of the lookup item in question.  Despite this, I still get the error when submitted.  

  • Verified answer
    Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    The record you are passing in the default formula is expecting a number for "ID" and string for "Value". You are using the same variable for both "ID" and "Value" because your lookup item ID is also the same as your Title field and I believe this is what is causing your issue. I am assuming your variable is storing the value as a string, so when you use it for "ID" it isn't a valid data type. Try wrapping the Value function around the variable when it is used with "ID" to convert it to a number.

     

    Here is an example.

     

    {
    '@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Id: Value(varWO),
    Value: varWO
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 462

#2
WarrenBelz Profile Picture

WarrenBelz 425 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 291

Last 30 days Overall leaderboard