About Me

My photo
Brooklyn, New York, United States

About Me




Sharif Shaalan
Principal Salesforce.com Consultant
@ roundCorner www.roundcorner.com
Principal Salesforce.com Consultant and Owner @ Agile Cloud Consulting LLC
www.agilecloudconsulting.com
Co-host of the yappexchange podcast www.yappexchange.com
Salesforce.com MVP
Certified Salesforce.com Sales Cloud Consultant
Certified Salesforce.com Developer
Certified Salesforce.com Advanced Administratior
Certified Salesforce.com Administrator

Search This Blog

Sunday, August 25, 2013

Blacklist Email Addresses Using V-Look Up and Validation Rules

This is a great solution posted by Deepak Anand on the Salesforce.com Answers community today.



1. If you have 400 Invalid Domains and just few Valid ones then why not write a VR checking if they all have the Valid Ones or Not:

AND(
NOT(CONTAINS(Email, 'gmail.com')),
NOT(CONTAINS(Email, 'yahoo.com')),
NOT(CONTAINS(Email, 'outlook.com'))
)

2. This is where VLOOKUP plays the best role! You actually don't need any Apex to get this done. I will explain how to do it. You can create a Custom Object say 'Invalid Email Domains' with two fields say:

(i) Domain Name[Name Field(Default)]
(ii) Description[Text Area]

Say we have 'example.com' is an Invalid One or Not Allowed One. If so a record will be created like as below:

Domain Name - example.com
Description - Does not comply with PCI Rules.

So in short the Name field should contain the Domain Name and the Description should help for future use. If that is done, you can then populate the Custom Object(Invalid Email Domains) with the records via the Native Data Loader or Dataloader.io or whatever. So the best part of this is that it becomes very User friendly in that sense where you could just create a New Record to indicate a Invalid Email Domain or remove an existing record if at all any one becomes Valid.

Now, how will we go about with the VR. Here you go:

MID(Email, FIND('@', Email)+1, LEN(Email)) =
VLOOKUP(
 $ObjectType.Invalid_Email_Domain__c.Fields.Name ,
 $ObjectType.Invalid_Email_Domain__c.Fields.Name ,
 MID(Email, FIND('@', Email)+1, LEN(Email))
)

MID(Email, FIND('@', Email)+1, LEN(Email)) extracts the portion just after '@' from an Email Field. For eg: if the email was john.dale@example.com the the result would be 'example.com'.

The VLOOKUP actually performs a scan on all the records belonging to the Custom Object - Invalid Email Domain(that we just created) and if any one record's Name field matches with the extracted text - 'example.com', then it returns the value contained in the Name field of that matched record and it will be equated with the extracted portion(MID(Email, FIND('@', Email)+1, LEN(Email))). If they are equal then it returns a 'TRUE' and the VR fires!

This is just yet another awesome feature of Force.com - VLOOKUP!

Thats it!. You are done!

14 comments:

  1. Nowadays, most of the businesses rely on cloud based CRM tool to power their business process. They want to access the business from anywhere and anytime. In such scenarios, salesforce CRM will ensure massive advantage to the business owners. Salesforce Course in Chennai|Salesforce Training Chennai

    ReplyDelete
  2. I ‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.
    selenium training in chennai

    ReplyDelete
  3. I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.

    selenium training in chennai
    aws training in chennai

    ReplyDelete
  4. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    python online training
    python training in OMR
    python training institute in chennai

    ReplyDelete
  5. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training in Chennai

    ReplyDelete
  6. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    ReplyDelete
  7. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete
  8. Have you been thinking about the power sources and the tiles whom use blocks I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post
    Microsoft Azure online training
    Selenium online training
    Java online training
    uipath online training
    Python online training


    ReplyDelete
  9. such an great post and amazing tips about semrush because i like it and thank you. keep it up.
    For Premium Accounts at cheap rate check this site premium Accounts Seller

    Netflix premium account -- Netflix premium Account

    Premium Accounts at cheap -- Hotstar premium Account



    Hotstar premium account -- Hotstar premium Account

    ReplyDelete
  10. Be a part of India's fast growing institution . As our institution is providing CS executive classes and free CSEET classes . So don't waste your valuable time and contact us or visit our website at https://uniqueacademyforcommerce.com/

    ReplyDelete
  11. I really enjoy reading your blog. this info will be helpful for me. Thanks for sharing.
    Jewellery ERP Software Dubai
    Jewellery ERP Software Dubai

    ReplyDelete