+ Start a Discussion
Tyler NealTyler Neal 

Validating a "Full Name" field?

I have a Flow that captures a full name in a single field (it later splits this up by First/Last when it needs to create a Contact), the issue I'm running into is some users are not entering last names, causing the flow to crash.

Is there an easy way to validate that a first and last name was entered?
srlawr uksrlawr uk
that sounds like a really dangerous way to collect data! I have three names, if I was asked to enter my full name I would enter all of them, and then your flow would have problems ;)

Basically - what you need to do though, I guess is verify that there is a SPACE in the entry?

You could use a Validation Rule on the field to ensure this, using the CONTAINS formula method? That way users could not submit the form with a name of only one part (I assume you are seperating over a space in your flow, at least?)
CONTAINS(Fullname__c,' ')

would return true if you had a two or more part entry.. so for a validation criteria, fire the rule on
NOT(CONTAINS(Fullname_c, ' '))

You could check this in an Apex trigger too quite easily, using the Apex String method (you guessed it) Contains... details here https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm

ithout knowing much mor about your user experience, or the flow of data you are talking about, I'm not sure how else to advise? If you are using Process Builder to launch yourt flow you could make the Contains thing part of the criteria in the PB? and launch a different flow (like send you an email) if they hadn't included a space.