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
2 votes
0 answers
611 views

Validation Rule on Lead Conversion - Best Practice

I have a Validation Rule on the Lead Object, to prevent the users from converting a Lead without filling in certain fields. The Validation works, but I want now to only requests those fields, if the ...
-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 ...
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 ...
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....
-1 votes
2 answers
128 views

lookup filter on custom object

I have a custom object A that has a lookup to Contact. In the Contact object I have a lookup to user. I want to filter the lookup to contact on object A so the only contacts allowed are the ones ...
0 votes
1 answer
385 views

Validation rule on multiple fields

I have 6 lookups and master-detail on a custom object. Each of these fields is for a custom object that is related one way or another to the Account Object (Different levels). The goal is to create a ...
0 votes
2 answers
278 views

Validation rule for Contact Number

i am trying to validate the contact no. it must be started with 7,8,9 only. Ex: 9493654336==> NO ERROR 6754294763==> ERROR Can anyone please help me out
0 votes
2 answers
830 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 ...
-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
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
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
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 ...
-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'...
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....
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 ...
-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
58 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
363 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, ...
-3 votes
1 answer
1k views

Why does it say MailingPostalCode doesn't exist?

It keeps saying that MailingPostalCode doesn't exist. It also says that Account.Id doesn't exist, as well as <> and Account. Someone please help!!!
-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. ...
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 ...
-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
2 answers
627 views

Database.convertLead - FIELD_CUSTOM_VALIDATION_EXCEPTION, Validation error on <sobject>: Validation Formula "<VR name>" Invalid (null) []

I am getting this error in test classes only when converting lead : caused by: System.DmlException: ConvertLead failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, ...
1 vote
1 answer
820 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 ...
-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 ...
-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 ...
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
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
2 answers
6k views

Catch validation rule error in apex and show in lwc

I have a validation rule which is stopping my record to get updated. I have to send just that specific validation error and display in lwc. Apex code:` }catch(Exception e){ throw ...
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
508 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
1k views

Validation rule that allow only number along with a specific string

I want a validation rule that should allow only number (0-9) and a specific string ('N/A') which contains a special character also. NOT(REGEX(Code__c, "[0-9,;N/A]*")) The above validation rule is ...
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 ...

1 2
3
4 5
24