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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (25,671)