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

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
Super User

Re: Validate text field with Salesforce data

@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.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Validate text field with Salesforce data

@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.

View solution in original post

AGuyCalledDave
Level: Powered On

Re: Validate text field with Salesforce data

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

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 (5,456)