cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sy8111
Regular Visitor

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

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

13 REPLIES 13
katunar
Helper III
Helper III

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
Regular Visitor

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

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
Regular Visitor

@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?

@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
Regular Visitor

@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.

What's inside the update property right now?

sy8111
Regular Visitor

@katunar 

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

type in ComboBoxCardxxx.Selected.Value

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (3,126)