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

Autofill Lookup field in a form

I am trying to autofill lookup field in a form like this:

 

Default = {

Id: UserLogin.ID,
Value: UserLogin.Title
}

It was working before now after moving to other enviroment it stopped working. 

Thanks in advance.

6 REPLIES 6
PavanKumar
Level 8

Re: Autofill Lookup field in a form

Hi, What exactly do you mean by its not working could you please elaborate? Regards, Pavan Kumar Garlapati
Community Support Team
Community Support Team

Re: Autofill Lookup field in a form

Hi @MuzaffarMahmood ,

Could you please share a bit more about your scenario?

Which data source do you use within your app? A SP list?

Further, could you please share a bit more about the UserLogin variable mentioned in your formula?

 

If you generated an app based on your SP list data source, the LookUp field would be rendered as a ComboBox control rather than Dropdown box within the Edit form.

So if you want to set a Default value for the LookUp field in the Edit form, please set the DefaultSelectedItems property of the ComboBox within the LookUp field data card in your Edit form to following:

{
  Id: UserLogin.ID,
  Value: UserLogin.Title
}

Please take a try with above solution, check if the issue is solved.

 

Note: Please set Default value within the  DefaultSelectedItems property of ComboBox rather than Default property.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MuzaffarMahmood
Level: Powered On

Re: Autofill Lookup field in a form

Firstly Thank you very much.

 

All datasources are sharepoint lists. 

 

"UseLogin" is global varilable like in screen OnVisible.

 

Set(UserLogin, LookUp(users_1, email=User().Email)); 

 

This lookup field (RequestorID) is linking to another list named "users". This is a create form of "requests" list. Each request is linked to a user in "users" list as shown in image attached. 

 

Is there any update in canvas app because some features are changed now. Before we can select field of the linked list instead of record Id in dropdown  and now it is not giving any option of selecting column to show in user front dropdown. As shown in image attached.   

MuzaffarMahmood
Level: Powered On

Re: Autofill Lookup field in a form

Yes you are right. It is  DefaultSelectedItems property of ComboBox rather than Default property for this thing. Thank you it is done.

Now the problem is it is not showing title of the user in dropdown options, it is showing Id of the users in dropdown options.

 

 

Community Support Team
Community Support Team

Re: Autofill Lookup field in a form

Hi @MuzaffarMahmood ,

Please make sure the Items property of the RequestorID ComboBox has been set to following formula:

Choices(requests.RequestorID)        /* <-- requests represents the Requests SP list */

 

Please change the Primary text property and SearchField property to Value column as below:1.JPG

 

If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
MuzaffarMahmood
Level: Powered On

Re: Autofill Lookup field in a form

Hi @v-xida-msft ,

 

I unable to find  Primary text property and SearchField property of combo box. I am finding in same place as you mentioned but not found there.

 

Best Regards,

Muzaffar 

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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