Skip to main content

Questions tagged [validation-rule]

Validation rules verify record data meets the standards you specify before the record can be saved.

Filter by
Sorted by
Tagged with
7 votes
1 answer
18k views

any way to handle validation rule errors nicely in flows

When working with a visual flow, it seems that when you get an error saving a record because of a validation rule, that the only error Salesforce will give you is: An unhandled fault has occurred in ...
KoenVM's user avatar
  • 2,436
7 votes
2 answers
1k views

Opportunity without products Validation rule

How would i create a field (formula?) to check if a opportunity has products that I can use for validation logic: IF productscount>0 (or products not null, empty) AND Probability>50% Then - error ...
Andy Ux's user avatar
  • 97
7 votes
2 answers
2k views

Count Line Breaks?

I am trying to count the number of lines in the BillingAddress field. I am familiar with the following methodology to count the number of times a substring occurs via formula: LEN(TextField__c) - LEN(...
Adrian Larson's user avatar
  • 151k
6 votes
2 answers
23k views

Record Type Validation Rule

I have written a validation rule, which checks whether a certain picklist has a certain value. The reason for this is, when someone changes the record type of account, then the picklist has different ...
Lily's user avatar
  • 1,395
6 votes
2 answers
356 views

Validation rule that requires a picklist value in a contact record once a picklist value in an opportunity record is selected

Is there anyway to make a contact record picklist value (Customer) become a required selection once a opportunity record picklist value (Closed Won) is selected? I ask because sales reps forget to ...
Katie's user avatar
  • 61
6 votes
1 answer
4k views

Can I use the $Permission variable in a validation rule?

I have an existing validation rule on a custom object that prevents users from selecting certain values in a picklist field, Stage__c, unless their user profile is equal to System Administrator' or '...
KShannon's user avatar
6 votes
1 answer
2k views

Runtime error on a validation rule?

I encountered the strangest error today, and I wanted to make sure that this is a real thing and not just a silly mistake of mine. I had a validation rule on Lead: And( isblank(Address), $...
SFDC Neuf's user avatar
  • 1,537
6 votes
2 answers
93 views

Forced execution of validation rules?

Is there a way to force execution of all validation rules? Ultimately, I'd like to test an oppty against VR's, just as if you Edit/Saved, but without modifying its timestamps. That way I can see how ...
Brian Newbold's user avatar
6 votes
1 answer
1k views

Phone Field in Custom Object

When I add Phone field in custom Object, I want to the user to enter minimum of 10 digits, if the user enters less than 10 digits they should get error [Just the numbers, no need of any special ...
Shrikanth KK's user avatar
5 votes
5 answers
8k views

Validation Rule : Error: Syntax error. Missing ')'

AND (Sync_to_system__c ,OR(CONTAINS(Job_Name__c , '\\') ,CONTAINS(Job_Name__c , '/') ,CONTAINS(Job_Name__c , ':') ,CONTAINS(Job_Name__c , '<') ,CONTAINS(Job_Name__c , '>') ,CONTAINS(Job_Name__c ,...
Tim Willis's user avatar
5 votes
2 answers
2k views

Determine if an SObject has an error

Is there a way to calculate if an SObject in a trigger context has had an error added to it (either with addError or through a validation rule)? I have some trigger processes I don't want to run if ...
Charles Koppelman's user avatar
5 votes
1 answer
2k views

Prevent user from editing or deleting a validation rule

I have a validation rule on Account object that prevent users, belonging to certain profiles, to edit a field. There is no issue with validation rule. Problem is, when I login as the user who is ...
Neerav's user avatar
  • 137
5 votes
1 answer
3k views

Formula Specific to Running User?

I have a requirement where a certain field can be edited without the validations firing for a particular user. Now I tried to write rule like LastModifiedId != '005000000000000AAA' but the validation ...
User2529's user avatar
  • 713
5 votes
7 answers
15k views

Validation rule Error message not displaying in LWC UpdateRecord toast event

I have a record which I'm updating via the UpdateRecord method from LWC, using Toast events to display success or error messages, which all works fine. What I'm not getting though, when there's a ...
Irene's user avatar
  • 1,885
5 votes
2 answers
63k views

FIELD_CUSTOM_VALIDATION_EXCEPTION happens without upserting the field

I wrote a script to export the data to SFDC using the bulk API 2.0 I upserts a bunch of user ids which is an external id of the object. I was expecting it returns errors "REQUIRED_FIELD_MISSING:...
Vera's user avatar
  • 73
5 votes
1 answer
789 views

ISBLANK() Always returns true

I was working on a validation rule formula, and noticed that whatever criteria I provided, the formula was returning true. I stripped out the criteria in the formula, until I had a simple formula: ...
battery.cord's user avatar
  • 8,873
5 votes
2 answers
1k views

Need Help Writing Validation rule for cases

I hate having to ask but it's my first week on the job and I already feel like I'm failing...I need to create a validation rule with the following criteria and keep coming up with syntax errors. ...
Marina P.'s user avatar
5 votes
1 answer
2k views

Spring 20 - Validation rules that use "$UserRole.DeveloperName" are triggering when they should not

After the Spring 20 release my validation rules that make use of the field "$UserRole.DeveloperName" are triggering when they should not. I'm currently trying to create a case from a community (with ...
Giulia Mascagni's user avatar
5 votes
3 answers
16k views

Validate if record has changed without checking all fields

We'd like to restrict record edits if the record is of a certain record type and the user is not one of several security profiles. We'd like to do this without having to check each and every one of ...
Swisher Sweet's user avatar
5 votes
2 answers
2k views

Programmatically Turn off Triggers/Validations/Workflow

I wanted to explore using a SandboxPostCopy class upon sandbox creation but ideally need to disable triggers, validation and workflow rules first. Is there a way to do this programmatically via apex? ...
Girbot's user avatar
  • 5,580
5 votes
0 answers
59 views

Why does assigning a role from the role hierarchy page bypass validation rules? [duplicate]

I set up a validation rule that prevents our delegated admin users from creating/updating a user to not have a role. The validation rule works exactly as expected when creating/updating the user ...
Kelly Shoemake's user avatar
5 votes
0 answers
2k views

Error: Request Entity Too Large: head - Any Suggestions?

I am creating my Data Model - Created one Custom Object with around 400 fields and 15-20 Validation Rules on it. Now, When I am trying to add more Validation Rules - It is giving me following error ...
Salesforce Steps's user avatar
4 votes
2 answers
1k views

How to avoid duplicate look up combination in many to many relationship?

I am trying to learn many to many relationships for salesforce objects, I was able to implement it using a junction object where there are two master-detail relationships. But it causes a duplicate ...
adnan_aust's user avatar
4 votes
1 answer
809 views

Regex - Syntax error

This is my regex (for international phone number), i have the message "Syntax Error" with this part of regex highlighted : s*[)]?[-\s.]?[(]?[0-9]{1,3}[)]?([-\s.]?[0-9]{3})([-\s.]?[0-9]{3,4})') ...
cpt_3n0x's user avatar
4 votes
1 answer
19k views

Using Permission Set in Validation Rule

Currently I have this in a Validation Rule: $Profile.Name <> "System Administrator" I would like to add another condition that checks a Permission Set. I have found a solution that uses Custom ...
mackmama's user avatar
  • 741
4 votes
1 answer
382 views

Why am I tripping over this validation rule?

While setting up a test fixture, my code fails when a FIELD_CUSTOM_VALIDATION_EXCEPTION is thrown during an Account record update. Here is the relevant part: theAccount = [select Id, Status__c, ...
JannieT's user avatar
  • 1,530
4 votes
1 answer
5k views

Validation Rule to fire only when updating field Manually

I am trying to create Validation that fire only when someone try to update record manually but it should not get fire if changes due to Process/Apex/Flow Any suggestion ? Validation Rule : AND(...
Sfdc_1184's user avatar
  • 153
4 votes
3 answers
4k views

Try/Catch Does not catch FIELD_CUSTOM_VALIDATION_EXCEPTION in trigger

I have created a validation rule on Account: Then i have written following trigger and its helper: trigger updateAccount on Opportunity (before insert,before update) { set<String> accId =...
Manisha Sadhnani's user avatar
4 votes
1 answer
575 views

Compiled length of validation rule functions

I have a validation rule that is around 3000 characters in length. It uses a the following functions (most of them quite a number of times): IF, NOT, OR, AND, LEN, BEGINS, SUBSTITUTE, VALUE and MOD. ...
user254875486's user avatar
4 votes
1 answer
767 views

Make first name mandatory using validation rule

I had this requirement where I had to make first name mandatory. I used validation rule to do so because you can't make just first name mandatory from the page layout. Now from the user perspective ...
Rimii's user avatar
  • 225
4 votes
1 answer
3k views

Allow Only Specific Profiles to Change Owner

Below is my Validation Rule. It does not allow a user with the Profile of 'management' to change the owner of a record. AND ( ISCHANGED(OwnerId), OR( PRIORVALUE (OwnerId ) <> $...
Nicole Ard's user avatar
4 votes
3 answers
4k views

Prevent Stage Skipping But Allow Regression

I'd like to prevent users from "skipping" Opportunity Stages, but not from reverting the Stage back. For example, I do not want a user to advance to Stage 5 without having been in Stage 4 immediately ...
Tamim J's user avatar
  • 213
4 votes
1 answer
4k views

Validation Rules not fired on Approval

I am having few validation rules on Opportunity, which should be fired when StageName is "Closed Won". An example validation rule is shown below AND ( ISPICKVAL(StageName, 'Closed Won'), ISBLANK( ...
Ashu Rana's user avatar
4 votes
2 answers
727 views

Cannot Delete Account - Where do merge validation rules live?

When I try to merge two accounts that have sales opportunities, I get the following validation exception: Cannot Delete Account Sales Opportunities Exist Based on the dearth of Google hits for ...
Tom Wright's user avatar
4 votes
1 answer
1k views

Duplicate Management - Packaging Matching Rules

Matching Rules and Duplicate Rules are a new feature in Salesforce. I see that matching rules can be pulled as metadata xml, but I can't find any documentation about packaging them. Can matching ...
powlo's user avatar
  • 2,690
4 votes
0 answers
278 views

Custom Permission in Validation Rule evaluating as Null when assigned

We have a requirement to prevent changes to a contract record once active unless the you are a contract admin, which can span multiple profiles. I'm trying to accomplish this by using a custom ...
david's user avatar
  • 61
4 votes
1 answer
736 views

REGEX Validation Rule for Phone Number [closed]

I am trying to create a validation rule for phone number and using the following regex Validation : NOT(REGEX( Phone, "^(?=.*?[1-9])[0-9()/\\-\\+\\s\\.\\ ]+$")) The above regex is working fine if ...
Aishwary's user avatar
3 votes
2 answers
10k views

Determine Case owner is queue or user?

how to check whether a case owner is a queue or a user? I am writing a validation rule where i need to check who is the owner of the case.
user8132's user avatar
  • 343
3 votes
2 answers
482 views

How can I ensure that a field is blank for some account types, and mandatory for others?

I have two picklist fields: Customer Management Account Type If Account Type = "Client" or "Client - Group Contract", Customer Management must not be left blank. If Account Type = "Prospect" or "...
user avatar
3 votes
2 answers
138 views

Help with formula for validation rule on user fields

I'm trying to create a validation rule requiring 3 fields to be populated for 3 profiles. Here is what i have so far. I gave up after continued syntax errors. I need both Zone Approver Fields and ...
Kelly's user avatar
  • 31
3 votes
1 answer
7k views

Can we use custom label in validation rule?

In my validation rule, $Profile.Name!='MyProfileName' is there. I have to replace this by using custom label. How can i accomplish that?
ram451's user avatar
  • 225
3 votes
1 answer
10k views

Validation rule - created date < FIXED DATE

I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as ...
Devin Pearman's user avatar
3 votes
1 answer
2k views

Regex in the validation rule

There is a field for 6 digit serial number in a record. Since the field can contain only numbers, I have created a validation rule with regex to check only numbers are entered in the text field. But ...
Seesh's user avatar
  • 754
3 votes
1 answer
2k views

Regex to validate Credit Card numbers

I have created a validation rule on a Log Text field, to check for Credit Card number for all major companies "(VISA, Master Card, Discover and Amex for now). Here is the validation rule: NOT( ...
mubs's user avatar
  • 312
3 votes
1 answer
34k views

How to bypass Validation rules when running apex class?

We have a managed package install in our org. When I create an opportunity, at a certain stage, I need to create a record of that managed package. For this we define validation rule for certain stages....
SFDCDJ's user avatar
  • 1,926
3 votes
1 answer
3k views

Datetime Difference in Validation Rule/Formula?

I am trying to make a validation rule for a Call Center that insures that when a call is manually entered, that it is not incorrect. I want a validation rule that checks that the call duration is less ...
mburgSolar's user avatar
3 votes
2 answers
200 views

field should start with 304050 in salesforce

I have a custom filed with number datatype and I have a requirement the the field should always start with 304050 and I have to write a condition that it must always contain 16 digits. Is this posible?...
Ankita Singh's user avatar
3 votes
3 answers
3k views

Opportunity validation rule not firing when fields are blank

I'm trying to get this validation rule on Opportunity to fire off whenever StageName = 'Decline to Bid' AND either Lost_Reason__c(Picklist) is blank OR Lost_Details__c(Text) is blank. In other words, ...
humanoid's user avatar
  • 327
3 votes
3 answers
3k views

How Can I run Workflows without them getting stopped by Validation Rules?

We have a number of validation rules that improve data quality as it is entered. However we have a number of records that are non-compliant with these validation rules. We've just added some ...
Denis Oakley's user avatar
3 votes
1 answer
9k views

Validation Rule If a checkbox is checked then another field should not be equal to some value

I have two fields. Closed (c2g__Closed__c) --> Checkbox Status (pse__Status__c) --> Picklist So if checkbox is checked, then the status should not be equal to Rejected. Here is what I wrote but ...
LazyBones's user avatar
  • 319

1
2 3 4 5
24