function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
YuckleYuckle 

How to restrict users from certain picklist choices

We have 4 possible values for case origin (Email, Web, Phone, Proactive).  We assign Email from Email-to-Case.  We assign Web for Web-to-Case.  When SF users create a case in SF, they can pick from all four origins.  I would like to restrict them from picking Email or Web.  Allowing only Phone or Proactive.

 

I have attempted to write a validation rule that knows when a case is new and from Email-to-Case or Web-to-Case allowing Weba nd Email, but preventing it for SF users except admins.  All attempts makes Email to Case fail with:

 

Email-to-Case: Error(s) encountered while processing

 

The following errors were encountered while processing an incoming email:

 

FIELD_CUSTOM_VALIDATION_EXCEPTION : Origin Email/Web is invalid for user created cases

It's clear I don't understand how to identify Email-to-Case cases.  It works as desired for SF users and Web-to-Case.

Here my validation rule (about version 12!):

AND   ( ISNEW(),                                                                                                if record is new
              NOT OR (   ISBLANK(Case_Owner__c) ,                                           if  owner blank (made Web-to_Case work) OR
                                   Case_Owner__c    = "Technical Support Queue",             if owner is queue (default owner for record types
                                   Case_Owner__c    = "Services Request Queue",
                                   Case_Owner__c    = "Jocie Garrett",                                  if default case owner

                                   CreatedBy.LastName  = "Garrett",
                                   $Profile.Name         =  "Q2: Systems Administrator",
                                   $Profile.Name         =  "System Administrator"   ),               if any of these don't create error
              OR           (   ISPICKVAL(Origin,  "Web") ,                                           if if not, error if origin = Email or Web
                                   ISPICKVAL(Origin,  "Email")  )
           )

But, as I said, this causes Email-to_Case to fail when it tries to set origin to Email.

 

Best Answer chosen by Admin (Salesforce Developers) 
SurekaSureka

Hi,

 

When you are creating Email Routing address, you have the option to default the "Case Origin", when the cases are created from email to case. Also you have the option to set the Case Record Type, so that you can create different record type restricting the picklist values and assign them to Email Cases.

 

If nothing works out, to identify whether the cases are created from Email to Case, You have a "Web Email" feild which gets populated when the cases are created through Email to Case.

 

Also you have "Emails" related lists, which captures the emails related a case, If the cases are created from Email to Case.

 

You can make use of these options.

 

Hope this solves.If so, Please mark the solution as solved.

 

Thanks

Sureka

All Answers

SurekaSureka

Hi,

 

When you are creating Email Routing address, you have the option to default the "Case Origin", when the cases are created from email to case. Also you have the option to set the Case Record Type, so that you can create different record type restricting the picklist values and assign them to Email Cases.

 

If nothing works out, to identify whether the cases are created from Email to Case, You have a "Web Email" feild which gets populated when the cases are created through Email to Case.

 

Also you have "Emails" related lists, which captures the emails related a case, If the cases are created from Email to Case.

 

You can make use of these options.

 

Hope this solves.If so, Please mark the solution as solved.

 

Thanks

Sureka

This was selected as the best answer
YuckleYuckle

Using Web Email as a criteia to identify Email-to-Case cases worked!  Thanks much