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

Lookup

Hi,

 

I have lookup field and i would like something like when i search and if the person i am looking is not on the record it automatically take you or prompt for new record.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Lookup

Hi @Ramole ,

Based on the issue that you mentioned, I think there is something wrong with your formula.

 

According to the needs that you mentioned, I think a Timer control could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Set the OnVisible property of current screen to following:

Set(IsStart, false)

Set the OnSelect property of the Company ComboBox to following:

Set(IsStart, true)

 

Add a Timer control in your screen, set the Duration property to following:

1000

set the Start property to following:

IsStart

set the OnTimerEnd property to following:

If(
   !IsBlank(DataCardValue118.SearchText) && Not(DataCardValue118.SearchText in Choices('Shipments '.Company).Value),
   Notify("The record you are searching is not existed in Customer List, please added it firstly!", NotificationType.Warning)
)

 

You could consider add another button (called "New Customer") in your screen, click it to navigate to your New Customer Screen. Within your New Customer screen, add a Edit form connects to your Customer List, use this Edit form to add new record in your Customer List. Set the OnVisible property of the new customer screen to following:

Set(IsStart, false)

 

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.

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: Lookup

Hi @Ramole 

 

I am assuming that you have a combobox/TextBox control to search a user, you can use the below expression on the "OnChange" property of the control as:
 
In case of Text Input control:
If(!(ControlName.Text in AddColumns(DataSourceName, "PersonColumn", LookUpColumnName.ColumntoSearchValue).PersonColumn), NewForm(FormName);Navigate(Screen1))
 
If case of Combobox control: 
If(!(ControlName.SearchText in AddColumns(DataSourceName, "PersonColumn", LookUpColumnName.ColumntoSearchValue).PersonColumn), NewForm(FormName);Navigate(Screen1))
 
Here, I have assumed that you have a separate screen where the user can add a new value to the lookup datasource.
 
If this differs, please share more details so that we might be able to help you better.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Ramole
Level: Powered On

Re: Lookup

Hi @yashag2255 

I have SharePoint List called shipments within that list i have a column called company is lookup and lookup is getting data from a List called Customers.

 

Thanks     

Dual Super User
Dual Super User

Re: Lookup

Hi @Ramole 

 

In that case, follow the steps:

1) If not created already, create a separate screen, lets say NewCustomerScreen to capture where user can enter details of a new customer.
Add an Edit form on this screen, set default mode property to New. Point it to Customer list and add the appropriate fields.
Form -> OnSuccess -> Refresh(Customers); Back()
Add a button to submit this user, Button -> OnSelect -> SubmitForm(FormName)

2) Now, on the "OnChange" property of the control where the user will input search criteria:
If(!(ControlName.Text in AddColumns(shipments, "LookUPCol", Company.Title).LookUPCol), NewForm(FormName);Navigate(NewCustomerScreen ))

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Ramole
Level: Powered On

Re: Lookup

Hi @yashag2255 

 

I dont know i am getting error please see the screenshot 

Thanks 

 

lookup.png

Dual Super User
Dual Super User

Re: Lookup

Hi @Ramole 

 

You are getting this error because the AddColumns expects three argument, second argument is the name of custom column that will be created. Can you update the expression to:

If(!(DataCardValue118.Selected.Value in AddColumns(shipments, "LookUPCol", Company.Value).LookUPCol), NewForm(FormName);Navigate(NewCustomerScreen ))

Here, "LookUPCol" is necessary, you can rename it to something of your choice. This is a typo used. You need to replace the LookUPCol at two places in the expression.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support Team
Community Support Team

Re: Lookup

Hi @Ramole ,

Based on the issue that you mentioned, I think there is something wrong with your formula.

 

According to the needs that you mentioned, I think a Timer control could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Set the OnVisible property of current screen to following:

Set(IsStart, false)

Set the OnSelect property of the Company ComboBox to following:

Set(IsStart, true)

 

Add a Timer control in your screen, set the Duration property to following:

1000

set the Start property to following:

IsStart

set the OnTimerEnd property to following:

If(
   !IsBlank(DataCardValue118.SearchText) && Not(DataCardValue118.SearchText in Choices('Shipments '.Company).Value),
   Notify("The record you are searching is not existed in Customer List, please added it firstly!", NotificationType.Warning)
)

 

You could consider add another button (called "New Customer") in your screen, click it to navigate to your New Customer Screen. Within your New Customer screen, add a Edit form connects to your Customer List, use this Edit form to add new record in your Customer List. Set the OnVisible property of the new customer screen to following:

Set(IsStart, false)

 

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.

View solution in original post

Helpful resources

Announcements
thirdimage

New Badges

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

Top Solution Authors
Top Kudoed Authors
Users online (5,520)