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
AAIAAI 

validation rule doesn´t save values

This rule works however, if the user chooses other value in the Stage name and chooses a required value for Product Support, this value doesn´t save. Any idea??. Thanks. Note: both field are picklist

IF(

 ISPICKVAL( StageName , "5 - Qualification"),

 ISPICKVAL( Product_Support__c, "None"),true)
Best Answer chosen by AAI
LBKLBK
Sorry my bad.

Missed a ).

Here is the correct one.
IF(
AND(
NOT(ISPICKVAL( StageName , "5 - Qualification")),
OR(
ISPICKVAL( Product_Support__c, "None"),
ISPICKVAL( Product_Support__c,"")))
,true
,false)

 

All Answers

LBKLBK
As per your formula, if you choose a stagename other than 5, it will always go to the second condition, that is true. so it will throw error message.

Can you elaborate on your requirement a bit in detail?
 
AAIAAI
I would need to code that, if user chooses the value qualification, it can be free to choose any value of product support field. However, if the user chooses other value different to qualification, he has to fill the product support field with any value. The question is that this value doesn´t save

Thanks
Amit Singh 1Amit Singh 1
You can achieve this making the dependent picklist. Use StageName as Controlling picklist and Support filed as Dependent field.
 
Please refer the below link for creating Dependent picklist.
https://developer.salesforce.com/docs/atlas.en-us.fundamentals.meta/fundamentals/adg_simple_app_adv_field_dependencies_try_it_out.htm

Let me know if this helps :)

Thanks,
Amit
 
LBKLBK
Please correct me if my understanding is wrong.

If the Stage is "Qualification", Product Support is not mandatory (it can be None). For all the other stages, it is mandatory to select a Product Support.

If my understanding it correct, here is your formula.

IF(
AND(
NOT(ISPICKVAL( StageName , "5 - Qualification")),
OR(ISPICKVAL( Product_Support__c, "None"),
ISPICKVAL( Product_Support__c,""))
,true
,false)
AAIAAI
Your understanding is correct however the formula doesn´t work.

Any idea?

Many thanks
Amit Singh 1Amit Singh 1
Ok Use below formula,
 
IF(
AND(NOT(ISPICKVAL( StageName , "5 - Qualification")),
OR(ISPICKVAL( Product_Support__c, "None"),ISPICKVAL( Product_Support__c,"")))
,true
,false)

Note: - Be sure that the value for StageName "5 - Qualification" is correct and there is no whiteSpace.

Let me know if this helps :)
Thanks,
Amit
LBKLBK
Sorry my bad.

Missed a ).

Here is the correct one.
IF(
AND(
NOT(ISPICKVAL( StageName , "5 - Qualification")),
OR(
ISPICKVAL( Product_Support__c, "None"),
ISPICKVAL( Product_Support__c,"")))
,true
,false)

 
This was selected as the best answer