cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Validate text field with Salesforce data

Hi All,

 

I  would say that understand the basic formals in powerapps, but this one stumpped me.

I'm looking at validating a text input with salesforce case numbers, the idea would be the user enters the case number, when they click the button the formula would check to see if the SF case is valid and is in a responded status, if this returned true it would take the user to the next screen.

 

We are stuck between using lookup and search to get a true or false reply, below is our thinking and are open to ideas:

If(Not(IsBlank(LookUp(Cases.'Case Number','Case Number' = TextInput1.Text, Cases.Status = "Responded"),Navigate('Main Screen',ScreenTransition.Fade),Notify("Case Cannot be found")))

 

Dave

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@AGuyCalledDave 

You're pretty close!  Your Lookup function is not correct.  A Lookup needs (at a minimum) a datasource/table, and a narrowing condition.  It returns either a reducing value or an entire record.  You can get more details on it in the documentation.

 

So, your formula should be this (the full record return from lookup method):

If(
   Not(IsBlank(LookUp(Cases,'Case Number' = TextInput1.Text && Cases.Status = "Responded").'Case Number')),
   Navigate('Main Screen',ScreenTransition.Fade),
   Notify("Case Cannot be found")
)

Or, the reducing version:

If( 
   Not(IsBlank(LookUp(Cases,'Case Number' = TextInput1.Text && Cases.Status = "Responded", 'Case Number'))), 
   Navigate('Main Screen',ScreenTransition.Fade), 
   Notify("Case Cannot be found") 
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

2 REPLIES 2
Super User III
Super User III

@AGuyCalledDave 

You're pretty close!  Your Lookup function is not correct.  A Lookup needs (at a minimum) a datasource/table, and a narrowing condition.  It returns either a reducing value or an entire record.  You can get more details on it in the documentation.

 

So, your formula should be this (the full record return from lookup method):

If(
   Not(IsBlank(LookUp(Cases,'Case Number' = TextInput1.Text && Cases.Status = "Responded").'Case Number')),
   Navigate('Main Screen',ScreenTransition.Fade),
   Notify("Case Cannot be found")
)

Or, the reducing version:

If( 
   Not(IsBlank(LookUp(Cases,'Case Number' = TextInput1.Text && Cases.Status = "Responded", 'Case Number'))), 
   Navigate('Main Screen',ScreenTransition.Fade), 
   Notify("Case Cannot be found") 
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

many thanks for help, seeing how you have presented it, I better understand.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,053)