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
VineetTVineetT 

Validation rules for Shipping address fields on Account + Using a User ID Override

Hello

 

I have created validation rules for each of the Shipping Address fileds in SFDC except for the Country field. The purpose for these rules are to prevent users from creating accounts with blank addresses. In addition to the simple validation rules I am trying to incorporate an override to where If UserID = 'UserID1','UserID2','UserID' Then skip validation.

 

I have had no success doing this, the main purpose is to load/edit accounts in SFDC from the dataloader where the accounts do not have all address fields filled out or if an Admin wants to modify an account that does not have all of the Shipping Address filled out.

 

Has anyone done something similar if so can you share your validation rule code?

 

Thank you all for your help!

Best Answer chosen by Admin (Salesforce Developers) 
MarkSilberMarkSilber

It would be best to set this based on the Profile Name of the currently logged in user (or user loading via Data Loader) versus specific IDs if at all possible. Here's sample of how this would look for both a Profile Name and a list of User IDs:

 

Profile Validation

 

AND(OR(LEN( ShippingStreet)=0, LEN( ShippingCity)=0, LEN( ShippingState)=0, LEN(ShippingPostalCode)=0), $Profile.Name <> "System Administrator")

 

 List of User IDs

 

 

AND(OR(LEN( ShippingStreet )=0, LEN( ShippingCity)=0, LEN( ShippingState)=0, LEN(ShippingPostalCode)=0), AND($User.Id <> "00550000000aaBB", $User.Id <> "00550000000aaCC", $User.Id <>"00550000000aaDD"))

 

 

 I updated my post to remove Country

Message Edited by Mark Silber on 08-12-2009 06:15 AM

All Answers

MarkSilberMarkSilber

It would be best to set this based on the Profile Name of the currently logged in user (or user loading via Data Loader) versus specific IDs if at all possible. Here's sample of how this would look for both a Profile Name and a list of User IDs:

 

Profile Validation

 

AND(OR(LEN( ShippingStreet)=0, LEN( ShippingCity)=0, LEN( ShippingState)=0, LEN(ShippingPostalCode)=0), $Profile.Name <> "System Administrator")

 

 List of User IDs

 

 

AND(OR(LEN( ShippingStreet )=0, LEN( ShippingCity)=0, LEN( ShippingState)=0, LEN(ShippingPostalCode)=0), AND($User.Id <> "00550000000aaBB", $User.Id <> "00550000000aaCC", $User.Id <>"00550000000aaDD"))

 

 

 I updated my post to remove Country

Message Edited by Mark Silber on 08-12-2009 06:15 AM
This was selected as the best answer
VineetTVineetT

Thank you very much Mark! This helps a ton!

 

Regards,

Vineet