Showing posts with label validation rule. Show all posts
Showing posts with label validation rule. Show all posts

Thursday, November 19, 2015

How I Give Myself an 'Admin Out' in Validation Rules

I've found myself stuck a few times when I've created a validation rule in Salesforce but needed to update records that would trigger my rule criteria.

Example: I don't want to allow users to update a specific field after it's been populated upon record creation. But, occasionally as the system admin, I may need to update that field when a user makes a mistake.

In the past, I'd edit the validation rule that was preventing me from saving a change and deactivate it. But when you have multiple rules that you're 'breaking', this becomes rather cumbersome.

So, I've started adding an 'admin out' to my rules. There are several ways to do this (by profile id, user id, etc), but here's what's working for me:



I add in a criteria to not allow the change for anyone except a system admin, as defined by the profile name.

This has been working well for me.

Word of warning: I don't recommend doing this for all rules, especially those that prevent changes that could cause errors in reporting or data consistency. Be selective if you choose to allow yourself an 'admin out.'

Do you have an alternative method that works for you? Let me know in the post comments or share it with me on twitter - @rathergeeky.



Tuesday, August 2, 2011

{Update} Val Rule to Prevent ‘Dear John L.’ has a Glitch – Fixed! #DataQuality @Salesforce

A few months ago, I shared a validation rule for Contacts to prevent sending emails with “Dear John L.”

My data quality check ensured that users didn’t enter a middle name in the first name field.

But, when I was doing some updates with the Excel Connector yesterday, I realized that my validation rule had a glitch.

It was correctly preventing middle names in the first name field, but it was also throwing the same error when they entered a name that happened to be abbreviated (such as “A. R.”). Or in this case, I was getting the error when I attempted to update the records en masse.

2011-08-01_144033

So, I’ve updated my rule to allow abbreviated first names by adding a function to my formula to cause it to fire only when the length of the field is greater than 5 characters.

This accounts for names where a space exists between the acronym or vice versa.

Here is the original error condition formula:

2011-08-01_144116

And here’s the updated one:

2011-08-01_144317

If you have a more effective way to accomplish this, please do share in the comments!

Related Posts

Jenna Baze is a rather geeky girl with average social skills and an affinity for: Google Apps, Salesforce.com, Pinterest, natural light photography and finding creative ways to avoid doing dishes (which includes updating a handful of blogs).
Email:
rathergeeky@gmail.com
Twitter: @RatherGeeky
Facebook: Rather Geeky Tips

Monday, February 28, 2011

Admin Journal: Preventing My @Salesforce Users from Including Time-Specific Information in Description Fields with a #Simple Validation Rule

dear_admin_journal

I’ve noticed while doing data cleaning that some users add date-specific information to Description fields on Accounts, Leads or Contacts.

Why This is Bad

No one may notice ‘must follow up by 12/11/2007 or earth will explode’ in the Description of a record such as an Account. That could be bad news.

An Easy Fix (Sorta)

To encourage users to log this information in the most efficient way, I an create a validation rule that looks for keywords in the Description field of a specific object, such as Account.

I can customize the rule based on the typical phrases that I know my users enter, such as ‘follow up on’.

image

I like to include a detailed error message so that the user will have a good idea of what their next step should be.

Error: You have included a 'Follow up' task in the Description field, where it may be overlooked. Please remove that reference from the Description field and add it instead as a related task.

I gave it a quick test and it worked.

image

I’m sure there are plenty of other ways to accomplish the same thing, but this simple rule is one way to gently herd my users in the right direction.

dear_admin_journal_end

 

Additional Resources

  • Haven’t heard of Salesforce? Find out about it here.

 

Jenna Baze is a rather geeky girl with average social skills and an affinity for: all things Google, Remember the Milk, Salesforce.com, Inbox Zero, Etsy, natural light photography and finding creative ways to avoid doing dishes (which includes updating a handful of blogs).
Email:
rathergeeky@gmail.com
Twitter: @RatherGeeky
Facebook: Rather Geeky Tips