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 / How to automatically p...
Power Apps
Unanswered

How to automatically populate default lookup ID in edit form data card

(0) ShareShare
ReportReport
Posted on by 27

Hi,

 

I am trying to automatically populate default lookup ID in edit form data card, the card has a combo box field. The underlying sharepoint lists are "Transactions" and "Transaction Log". This edit form is about adding record to "Transaction Log" when user select Add_Note button of an item of gallery "Transaction".  

 

"Transaction Log" list has a lookup column "Transaction ID" which is linked to the default ID column of "Transaction".

 

Capture.PNG

 When this edit form shows up, I want the data card "Transaction ID" automatically populated with the transaction ID selected in the transaction gallery, so I set the combo box's defaultSelectedItems field to below, but got error shown.

Capture2.PNG

 

First of all, is this the correct field to set the default choice in combo box card? Second, what is the right formula and what does the error mean?

 

Thanks

Categories:
I have the same question (0)
  • katunar Profile Picture
    117 on at

    Hi @sy8111

     

    Do you just want to display the ID you selected in the previous gallery?

    If so, I would recommend to use a simple label and put "GalleryTransactions.Selected.ID" in the Text property of that label.

     

    If you want to keep the combo box, you need to put the the following code in the Items property and DefaultSelectedItems property of the combo box.

    [GalleryTransactions.Selected.ID]

    Don't forget the brackets!

  • sy8111 Profile Picture
    27 on at

    @katunar Thanks! It finally works. What is the [] ? Does it define a list of values?

  • katunar Profile Picture
    117 on at

    Yes @sy8111,

    If you want to display values in a combo box or dropdown, you can either connect a data source to the items property or insert a list of values in the items property with the brackets: ["first value", "second value", third value"]

  • sy8111 Profile Picture
    27 on at

    @katunar Now when I click Add button, the record is added to "Transaction Log" list, but without the ID. The transaction ID column is blank. How can I also pass the default ID to SubmitForm?

  • katunar Profile Picture
    117 on at

    @sy8111 your form is build like this:

     

     

    Form

        DataCard1

            StarVisible

            ErrorMessage

            DataCardValue

            DataCardKey

        DataCard2

            .

            .

            .

     

    You need to make sure that the Update property of the DataCard is set properly. If you used the combo box, you need to type in the following formula in the update property:

    ComboBoxName.Selected.Value

     

    If you can't type into the Update property, you need to select the data card and select the "advaced" tab on the right hand side. There you should see a locked icon. Select the locked icon and you will be able to change the update property.

     

  • sy8111 Profile Picture
    27 on at

    @katunar My card's Update field is correct. It can't be DataCardValue11.Selected.ID like you said, but has to be DataCardValue11.Selected, because it has to be a Record value. But still, the SubmitForm() doesn't save the ID, but other fields are fine. So I have to go to sharepoint list to manually fill ID for the new row.

  • katunar Profile Picture
    117 on at

    What's inside the update property right now?

  • sy8111 Profile Picture
    27 on at

    @katunar 

    Right now it's the system defaul "ComboBoxCardxxx.selected"

  • katunar Profile Picture
    117 on at
    type in ComboBoxCardxxx.Selected.Value
  • sy8111 Profile Picture
    27 on at

    @katunar That gives error: expect Record value

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard