You need to sign in to do that
Don't have an account?
Afzaal Hassan
How to check if an email contains the right format
I had a simple question. I want to check if an email entered in the form is the right format. How do you splice in apex? In other words I want to see that after the @ symbol, we only have gmail.com. I was going to write something like
if(email__c.contains('@gmail.com'){} but then I realized that this may not be enough because someone could potentially enter an email of gmail.com@hotmail.com for example. So I want to see what I can write in apex to check if the email is in the format ###@gmail.com
Thank you
if(email__c.contains('@gmail.com'){} but then I realized that this may not be enough because someone could potentially enter an email of gmail.com@hotmail.com for example. So I want to see what I can write in apex to check if the email is in the format ###@gmail.com
Thank you
-greg
All Answers
-greg
public class LPP_ContactInsertOnboarding {
@InvocableMethod(label='Insert Contacts' description='creates new contact record for the flow.')
public static List<String> insertContacts(List<Contact> conLst){
List<String> contactMsg = new List<String>();
try{
insert conLst;
//contactMsg.add('Contact record for ' + conLst[0].FirstName + conLst[0].LastName + 'has been created. Click Next for User setup.');
contactMsg.add(conLst[0].id);
}catch(Exception e){
contactMsg.add('Error in creating contact record. The reason is because: ' + e.getMessage() + 'Please hit the Next button to go back to the form and enter this missing field.');
}// WILL NEED ANOTHER CATCH STATEMENT?
system.debug(contactMsg);
return contactMsg;
}
}