Questions tagged [validation-rule]
Validation rules verify record data meets the standards you specify before the record can be saved.
1,114
questions
0
votes
0
answers
45
views
Struggling with a validation rule
Enforce Customer ID Format - The customer ID should include the 2-character billing country code, a dash, and an 8-digit number (for example, US-12345678). Each customer ID must be exactly 11 ...
-1
votes
1
answer
35
views
Contacts can only be linked to Accounts with ownership set to private
I have a requirement in a salesforce project.
Contacts can only be linked with an account that has Ownership field set to private.
I simply did a validation rule on Contact :
NOT(ISPICKVAL(Account....
-1
votes
1
answer
53
views
Validation Rule on picklist fields
I need to create a validation rule to make one picklist field mandatory dependent on another. if the controlling picklist field has a value of "A", then the dependent picklist field cannot ...
0
votes
1
answer
34
views
Apex is throwing error but LWC is not catching and displaying the correct Toast message
I have created a validation rule on Order Product Object, it is working as expected on the record page. While making changes from LWC, error message is not shown, instead a success message is showing ...
-2
votes
1
answer
41
views
Validation rule with Regex
I am creating a validation rule using regex , can someone help here. If the company picklist value is 'Electrical', then only Account Number can have hyphen. for other company picklist values , hyphen ...
0
votes
1
answer
32
views
Validation Rule for specific text values
I have a requirement to create a validation rule on a text field where the values must be capitalized, and restricted to specific values. I realize that converting this field to a picklist is the ...
-3
votes
2
answers
44
views
Validation Rule on case object
Could you please correct me this validation rule
AND(
OR(
RecordType.DeveloperName = 'RMA',
RecordType.DeveloperName = 'Device_Swap'
),
NOT(ISBLANK(...
0
votes
1
answer
30
views
Throw Validation On Quote - Deal duration(Between Start date and Endate) can't be less than 1 year (or 12 months)
I want to throw Validation on Quote whenever user enters start date and end date, they should get an error if the deal duration is less than 1 year
E.g. :- Start Date is 14/9/2022 and End date is 13/9/...
0
votes
0
answers
31
views
Flow on Task to trigger validation rule
I have a validation rule on the Task object which simply points to a checkbox field, if true then error.
I am using a fast field update flow with some simple logic that, according to the debugger, ...
0
votes
2
answers
48
views
Validation rule to prevent field change
I have trouble with this validation rule on Account. It should allow changes on MainBrand__c only if MainBrand__pr.WebsiteRelevant__c = true and RegistrationDoubleOptin__c = true. I tried this but not ...
0
votes
1
answer
30
views
Validation rule not displaying error message
I have an Opportunity which has Type = ZMS - Budget Increase and Offerings = ZMS. If those conditions are met, then I won't be able to modify couple of fields -> offerings cannot be modified either....
1
vote
1
answer
62
views
Problem with a validation rule in Order Item
Hey everyone I'm kind of a newbie in my journey in salesforce. And I'm kind of struggling with this one validation rule I'm trying to write.
Now the thing is in Order Item there is the product code ...
0
votes
1
answer
29
views
Trouble with context when updating a validation rule
I have an existing Validation rule on the Case that someone assisted me with earlier because it wasn't firing.
Now that it's firing accurately, there is additional criteria I need to add to it but I'm ...
0
votes
1
answer
30
views
Help with a Validation Rule firing
I need to stop all users from updating a Case record that has a current Status = Request Approved, UNLESS all the following is met:
The running user has a Profile = HelpDesk User OR System ...
-2
votes
1
answer
50
views
Salesforce validation Formula error Validation Invalid (null)
I have crated the following formula
AND(
ISPICKVAL(Lived_Since__c, "- 0-24 months"),
ISBLANK(Previous_Address__c)
)
for the scenario if the lived since field has a value of - 0-24 ...
0
votes
2
answers
64
views
Bypass lookup filter
I have a lookup filter which I want to bypass as a system administrator when doing i.e. data imports.
I found possible solutions but they dont seem to be working.
Added a second filter condition OR ...
0
votes
1
answer
29
views
Validation Rule - Restrict update to Profile if Profile = System Administrator
I'm trying to create a validation rule that prevents users with the "Application Administrator" profile from updating any fields for "System Administrator" users on the User object....
-1
votes
1
answer
35
views
Make a field mandatory with validation rules
Trying to create a validation rule on the Case object in Salesforce. The rule should make the 'TechnicalAssistance__c' field mandatory based on the selected value in the 'EnviarEmailParaAssistencia__c'...
-1
votes
2
answers
39
views
Seeking Guidance: Email Validation Error Handling for Specific Scenarios for field in account object
I'm facing an email validation challenge for my project. I want to throw an error if any of the following scenarios are met:
The email has numbers at the end, like '[email protected]'.
The email ...
0
votes
0
answers
33
views
Validation Rule Question - Required Fields
Hoping someone can help me figure out my validation rule. I'm pretty new to writing code so any help is appreciated. I want my rule to state: If the picklist value is soft closed or closed then to ...
-1
votes
2
answers
41
views
Restrict update to a field
If a particular user updates the field only that specific user can edit the field further. Any restriction shouldn't be there for the initial population of data. How can I use the validation rule here,...
0
votes
1
answer
43
views
Locking A Record for users with Standard User Profile when the Status field on Campaigns is Equal to Completed
I have a group of users with the same profile (standard user) and I need to lock records from editing that they own when the Campaign status field equals Completed. However, they need to be able to ...
0
votes
1
answer
25
views
Is it possible to use an object field as part of regex rule?
Let's say I'm looking to use the state abbreviation as part of a validation rule, for example, California: CA-1111.
I'm trying the following logic but it's not returning the desired output.
NOT(REGEX(...
1
vote
2
answers
38
views
Validation Rule to only Fire when Stage ISCHANGED
I have a validation rule that I only want to fire if the stage is changed. So if the opportunity is already in that stage I don't want the rule to fire if I change other values in the opp. I've used ...
-2
votes
1
answer
31
views
Validation rule on phone number field
When I make a validation rule on phone number field that the phone number field should only contains number and only 10 digits allowed, but when making new records the phone number field is required, ...
-2
votes
2
answers
37
views
How to restrict some 3 digit company codes from a text field under Company
we currently have a 'Company Short Name' field under our Company object, and in this field the sales team put a 3 letter abbreviation of the company name.
I would like to stop certain 3 letters being ...
0
votes
1
answer
42
views
ISO Case Validation Rule where Status = X, (A cannot be blank), and (either B or C cannot be blank)
I've tried several iterations of formulas, but can't get the last section to work. It is intended that the Validation would fire when trying to change to the specific status, if the criteria were met. ...
0
votes
1
answer
28
views
Approach to know the record belongs to specific record types (Apex,Flows,Validation rules)
We have around 50 record types on case. Soon we are going to merge our code with another instance where 20 more record types are present.
What will be the best approach to run my apex code, validation ...
1
vote
1
answer
107
views
Restrict users from changing Opportunity Stage thorugh UI
I have a task to prevent users from changing the Opportunity Stage manually, except for a subset of users which do not share the same profile. I created a custom permission and a new permission set ...
-1
votes
1
answer
29
views
Nested OR function in validation
We're trying to add another validation to require either
ISBLANK(Commission_Percentage__c) OR ISBLANK(Commission_Amount__c), since they only have to complete one of these fields in addition to the ...
-2
votes
1
answer
109
views
Regular expression for specific email address format in a validation rule
I have a regular expression which requires emails to be in [email protected] format.
I want to tweak to be [email protected] OR fir[email protected] where 'i' would be ...
0
votes
1
answer
52
views
Salesforce Opportunities Object - Validation Rules - Make checkboxes mandatory to progress stage
This is my first time posting on the stack exchange so apologies if any key information is missing from my question.
I am trying to create a validation rule to make certain checkbox fields in the ...
0
votes
0
answers
30
views
Unable to get Validation Rule to work
I am trying to create a validation rule in Salesforce that prevents a host Opportunity Record (ID-0125G000000GWLlQAO) Type from moving to a closed won stage (8. Deal Won) without the "Number of ...
0
votes
1
answer
27
views
Setting Field Validation for Date Field Typo
I have a field validation for close date on the opportunity object. The goal is that the date cannot be over 4 years ago.
This date field is part of flow, and I noticed that when I did the date ...
0
votes
1
answer
64
views
Validation rule to prevent more than a certain number of one character in a text field
Is it possible to include in a validation rule for a text field to only allow X amount of commas? I am trying to limit the amount of emails that are currently seperated by a comma.
0
votes
1
answer
73
views
Validation rule not working for Decimal values
I've created Validation rule for Sales Price should be greater than market price on opportunity line item.
But it seems this validation rule is not working for decimal values.
Below is simple ...
1
vote
2
answers
70
views
How to Write a Data Validation Formula for an Active field needing a start date but no end date
My instructions have three conditions (only one of them is stumping me "no end date"):
if a field status is "active", you must have a start date and no end date
if it is "...
0
votes
1
answer
72
views
Compare a multi-select picklist with another picklist in a Validation Rule
There is a picklist field on account as OKOCE_Country__c and on user object we have QIDC__OK_Available_Countries_ims__c multiplist field.
I want a validation rule to check is ...
0
votes
1
answer
64
views
Validation Rule. Change ownership only if the user is the owner or the owner is "x" user
I created a Validation Rule to prevent a user to change the record's ownership when is not the owner:
$User.Id <> PriorValue(OwnerId) && ISCHANGED( OwnerId )
It worked.
But I also need ...
0
votes
1
answer
60
views
DOB Validation rule
I am new to validation rules and could use some help. I have a date field for users to fill out for their date of birth. This field requires them to use the "calendar" and many are not ...
2
votes
1
answer
120
views
Is this validation rule written as the logic I'm trying to follow?
AND(
Ready_for_Booking__c,
OR(
NOT(ISPICKVAL(StageName, "Purchasing")),
NOT(ISPICKVAL(StageName, "Closed Won")),
NOT(ISPICKVAL(StageName, "Closed ...
0
votes
1
answer
24
views
Validation rule to restrict picklist but still allow others to edit the record
I have a validation rule that restricts a picklist value so that only two users can select it. This is working well but the problem we're facing is that now no one, except those two users, can edit ...
2
votes
1
answer
116
views
Validation Rule on Case checking user's profile
I need to change picklist default value in the status of an external insurance case to "under review" if the users creating the record are Angelita, Caio or Ivan (Profile: External Insurance)...
-1
votes
1
answer
56
views
How do I write a validation rule for a Date/Time field that only allows choosing M-F and 8am-5PM
I have tried using the formula below:
NOT(
AND(
WEEKDAY(DATEVALUE(Date_Time_Test__c)) >= 2,
WEEKDAY(DATEVALUE(Date_Time_Test__c)) <= 6,
HOUR(TIMEVALUE(Date_Time_Test__c)) >= 6,
...
0
votes
2
answers
112
views
Regex for Aadhar card is throwing an error
used this for validating Aadhar card
NOT(REGEX(Aadhar_Number__c , "[0-9]{12}"))
and I'm getting this error
Incorrect argument type for function 'REGEX()'.
0
votes
0
answers
33
views
Problems with validation rules on Users
Been trying to set a validation rule on User Object where a field (Calendar_URL__c) becomes required for 2 specific profiles.
The validation rule doesn't get triggered, no error whatsoever.
here is ...
0
votes
1
answer
97
views
Formula to restrict text field inputs?
I need to validate input on a screen flow's text field so that only "EB, EO, GA" are acceptable inputs from the user (Normally I'd just use a picklist but the client wants to leverage an ...
0
votes
0
answers
84
views
Validation rule preventing going back in Oppty stages while allowing user to close deals
I am trying to create a validation rule for Oppty object that:
Prevents users from going back in Oppty stages unless user has certain types of profile
Still allows users to close lost or won deals
...
1
vote
2
answers
111
views
Validation rule field mandatory only for unique profile
I need a specific case (here: Queue) owner to fill a field when the case is reassigned back to another owner.
In other words: We get a case via email. We fill out the necessary fields and then ...
0
votes
0
answers
45
views
How do you make opportunities go through each stage of the sales cycle sequentially (no skipping stages), but allow regression
I've followed the advise on other threads to use the following formula, but it isn't working for me - it is preventing any movement.
AND(
$Profile.Name <> "System Administrator",
...