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".
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.
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?
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.
Don't forget the brackets!
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"]
@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:
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:
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.
@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.
Class of 2020- Season 2
Featuring samples like Return to the Workplace and Emergency Response Applications
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Features releasing from October 2020 through March 2021