Questions tagged [validation-rule]
Validation rules verify record data meets the standards you specify before the record can be saved.
1,156 questions
1
vote
1
answer
145
views
Can you automatically retry a trigger if record validation fails without user intervention?
We have a custom field with the Unique Id attribute. This field represents a randomly generated string that is used as a publicly facing identifier.
This public id field is randomly generated and ...
-1
votes
2
answers
106
views
Validation rule for Multi picklist
I have a requirement where if a value "Others" from a Multi picklist is selected, "please explain others" text box should be used, if any other value from Multi picklist is ...
0
votes
0
answers
93
views
Validation rule to prevent editing a record [duplicate]
I'm new to validation rules and I'm trying to write one for a custom object that looks at a field called Status and once the picklist value is changed to "Complete", then no one can edit any ...
-1
votes
1
answer
266
views
Validation Rule for locking specific fields
I am looking to create a validation rule that if the checkbox "verified" ( Verified__c ) is checked then it locks these three fields, Legal_Entity_Name__c , ...
-2
votes
1
answer
358
views
I need to exclude one profile from a validation rule
Lead Source a mandatory field and the validation rule on conversion means it has to be completed. this is true for all our users with the exception of 1 user profile. How can I exclude them from this ...
0
votes
2
answers
89
views
dependent text field validation issue
I'm writing a validation rule for dependent text field. If user has selected "Other" option then must fill text field. ---> done like below
But if any value choosen except "Other&...
0
votes
0
answers
103
views
Why insert is rolled back when validation triggered in bulk update
I have list of 2 records i try to update in bulk from object foo__c, this should trigger an insert of 2 records from the object zoo__c.
One of the updated foo records hits a validation rule (as ...
-1
votes
1
answer
166
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....
0
votes
1
answer
1k
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
103
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
1k
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
112
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
128
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
114
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
94
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
426
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
187
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
175
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
55
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
392
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
829
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
172
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
574
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
331
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
57
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
223
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
362
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
32
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
678
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
272
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
46
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
45
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. ...
-1
votes
1
answer
140
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
819
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
51
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
1k
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 [email protected] where 'i' would be ...
0
votes
1
answer
233
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
111
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
44
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
266
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
246
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
331
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
286
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
507
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
578
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
134
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
42
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
223
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
538
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
365
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()'.