My project is an inventory management system, using two SharePoint lists; TBL_Locations and TBL_Assets. TBL_Assets has a lookup column called "LocationNumber" to a column in Locations called "LocationNumber".
I have created a standard app from the TBL_Locations list, and added a gallery to the second screen which shows the assets for the specified location.
I've added a button which opens the form to create a new asset. It doesn't really make sense to have a user select the LocationNumber manually since they have already selected a location to be working from, so I'd like to have that field automatically populate based on the Screen_Location.Selected.LocationNumber value.
However this doesn't appera to be quite a straightforword as I would expect, and I haven't been able to follow the other discussions on similar topics in this forum to achieve this goal.
Is Screen_Location a screen with a Gallery control?
Do you want to create a NewForm to add new records to Assets list? And on the NewForm, you have a Dropdown control that you that you want to show the LocationNumber based on the Screen_Location.Selected automatically without selecting from the drop down items.
Please feel free correct me if I misunderstand you.
Maybe this could solve your problem to populate the dropdown.
So you have a selected item from your gallery and want to fill in a value from the dropdown that is linked to the selected item right.
So what you could do is this:
The .Text is optional if it is already a text field.
Hope this helps
I can't seem to even get the search function working. It keeps saying that I'm using invalid arguments but as per the documentation I'm supplying a table, search query, and column. Here's a screenshot of my window
I'm not sure how much it's worth troubleshooting as for the time being I have stopped using the lookup column due to it not being supported for delegation.
Still no good. Also according to this page "Filter, Search, and LookUp functions in PowerApps" the 3rd argument in Search should be used like so:
Also note that the "Center Number" field is the same as "LocationNumber". I added it in there to get the app to work properly. It's just a regular number column and not a lookup.
This is definitely NOT the best approach to do, but I created a object with values needed on the LookUp object to be added to form.
The default property looks like this:
'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";
Id : <id_from_the_item_in_the_lookupfield>;
If you use First(Search(...))
You need to put a field after the bracket from the function First like this
I'm having the same problem, and I tried your suggested solution @Tom_Slosse. And while I managed to get the dropdown to successfully show item I want as a default, I receive an error upon submitting the form:
"The requested operation is invalid. Server Response: A value must be provided for item".
A quick search for the problem didn't give a lot of info, besides the problem arising for someone using a people field (which behaves the same way due to it also being a sort of lookup). I was wondering how you managed to get this solution without running into the same issue I did? Are there any other steps besides setting the default value? Do you combine this with another method of saving the data besides SubmitForm()? Like Patch for example, which I have seen referenced sometimes, but haven't tried using myself yet.
Second question to @camel:
I've tried your solution as well, adding the bracketed odata-thingy as the Default property of the dropdown connected to the SharePoint Lookup field. But contrary to the above solution, this gives me the following error:
"The requested operation is invalid. Server Response: Value cannot be null. Parameter name: source"
So the same applies here. The default value I want is set successfully, but I can't submit the form. Any ideas?