cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sy8111
Level: Powered On

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
Level: Powered On

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

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
Level: Powered On

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

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

katunar
Level: Powered On

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

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
Level: Powered On

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

@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
Level: Powered On

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

@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
Level: Powered On

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

@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
Level: Powered On

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

What's inside the update property right now?

sy8111
Level: Powered On

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

@katunar 

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

katunar
Level: Powered On

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

type in ComboBoxCardxxx.Selected.Value

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,999)