function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kitty BarnesKitty Barnes 

Need Help writing a validation rule

I am new to writing validation rules and am stuck.  I need to write a rule so that a person can not change a project status to active unless a picklist field called foundation type is filled out. This would only apply to projects that fall within certain departments.

User-added image
 
Best Answer chosen by Kitty Barnes
Maharajan CMaharajan C
Hi Kitty,

You have to write the validation rule like below:
 
AND( 
ISPICKVAL(Project_Status__c, "Active"),
ISBLANK(TEXT(Foundation_Type__c)),
OR(
ISPICKVAL(ProjDept__c, "Custom"), 
ISPICKVAL(ProjDept__c, "Commercial"), 
ISPICKVAL(ProjDept__c, "Addition")
)
)

Thanks,
Maharajan.C

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Kitty,

I don't think you would be able to show an error on standard functionality the validation rule only kicks in when the record is about to be saved. You can try checking the below thread  best answer:
>> https://salesforce.stackexchange.com/questions/213783/restrict-a-picklist-field-value-if-a-different-field-on-same-object-false

Answer:

You can use a simple validation rule, if your preference is to surface an error. (You've tagged your question validation-rule). Something like

ISPICKVAL(My_picklist__c, 'RESTRICTED_VALUE') && NOT(Other_field__c)
This assumes that Other_field__c is a checkbox field.

Note, however, that this doesn't disable the entry in the picklist user interface: it simply prevents a record from being saved with this combination of data points.

Alternately, you can make a checkbox field the controlling field (https://help.salesforce.com/articleView?id=sf.fields_defining_field_dependencies.htm&type=5) of your picklist. This would allow you to determine which picklist choices show up at all based on the checkbox's selection state.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Malni Chandrasekaran 2Malni Chandrasekaran 2
Hi Kitty,
You have to use the logical operator AND or OR to connect the conditions. 

AND(
condition1,
condition2,
condition3
)

Hope this helps!
 
Maharajan CMaharajan C
Hi Kitty,

You have to write the validation rule like below:
 
AND( 
ISPICKVAL(Project_Status__c, "Active"),
ISBLANK(TEXT(Foundation_Type__c)),
OR(
ISPICKVAL(ProjDept__c, "Custom"), 
ISPICKVAL(ProjDept__c, "Commercial"), 
ISPICKVAL(ProjDept__c, "Addition")
)
)

Thanks,
Maharajan.C
This was selected as the best answer
frsdwf gvrfdegfrsdwf gvrfdeg
Try to add new conisditons. I'm using the same script for my website (https://iriveramerica.com/) that hosted on WordPress.
Samiha LeeSamiha Lee
Option to choose the writer independently. If you are thinking about buying an essay https://samedaywriting.com/, it will be wise to know more about the person who writes your paper.
John Downe 2John Downe 2

We provide you with the most affordable writing service that you ever dreamed of. We offer custom written essays at remarkable prices that save you money. When you choose us, you always https://jackkranes.substack.com/p/college-admission-essay-help-how get custom essays at reasonable prices with good discounts as well.
We focus on keeping our prices low, but unlike other academic writing services online, we never sacrifice quality for the sake of price. We thrive on service orientation; our mission is to increase customer loyalty by providing nonparallel services and after sales support.
telo michaeltelo michael
It helped us here at lyrics (https://lyrics-in-hindi.com/)page , currently running on wordpres
amna sajjadamna sajjad
Am also need help in writing this type of issues am need that noe one change my my site dat without my permission am drop link (https://themotorday.com/best-adventure-motorcycle-helmet/)of my site hre plsease check it 
Logan LeeLogan Lee
Never mind the difficulty of your subject. Our team has experts in all competencies. Field-specific subjects included. The quality of your paper is beyond any dispute. We follow your requirements accurately GradeMiners (https://grademiners.com/) and stick to academic writing standards.
Doramas mp4Doramas mp4
Download latest apps and games only on
Apksociety (https://apksociety.com/)
Rajeev Singh 121Rajeev Singh 121
I like reading your blog! Thank you for writing some useful posts. also see WhatsApp Status (https://befunky.in/whatsapp-status/), also Inspirational Quotes in English (https://befunky.in/inspirational-quotes/) cute love status (https://befunky.in/love-status/) , dosti status (https://befunky.in/dosti-status/)