You need to sign in to do that
Don't have an account?
Help with a Validation Rule
I have two fiellds on object Colors , Rejection Reason
Colors is MULTISELECT picklist
Rejection Reason is just a picklist
Whenever the colors B,C,D,E,F,G in any combination are selected Rejection Reason field is mandatory
Whenever the color A is selected Rejection Reason is not mandatory
Whenever the color A is selected along with B,C,D,E,F,G (any combination as it is a multi select picklist ) Rejection Reason is not mandatory
Colors has the following values
A, B ,C ,D,E,F,G ,H
I am able to get through all scenarios except the third
Can anybody please be a life saver for me
AND(
NOT(INCLUDES( Multi_Select_picklist__c , "A")),
ISBLANK(TEXT(Type))
)
Type is the normal picklsit field
All Answers
Please use INCLUDES() function in validation rule.
Formula: INCLUDES(Colors__c, "A") && NOT(ISBLANK(Rejection_Reason__c))
Please accept as solution if it works
Thanks,
Anil
Your Solution wi;; not work
Formula: INCLUDES(Colors__c, "A") && NOT(ISBLANK(Rejection_Reason__c))
NOT IS BLANK cannot be used for picklist
So we cannot get the functionality
AND(
NOT(INCLUDES(Colors__c, "A")),
ISBLANK(TEXT(Rejection_Reason__c))
)
Trigger Code :-
trigger Picklist_test on Object1__c (before insert, before update) {
for (Object1__c a:Trigger.new){
string text = 'B;C;D;E;F;G';
Boolean res1 = text.equals(a.Colors__c);
string val1 = a.Colors__c;
list <string> val = val1.split(';');
Boolean res2 = false;
for (string s:val)
{
if (s.equals('A'))
res2 = true;
}
if (res1==true)
{
a.Rejection_Reason__c = 'Mandatory';
}
else if (res2 ==true)
{
a.Rejection_Reason__c = 'Not Mandatory';
}
}
}
Mark SOLVED if it helps :)
@Jerun You cannot use a NOT for an include function as it is a multi select pick list
AND(
NOT(INCLUDES( Multi_Select_picklist__c , "A")),
ISBLANK(TEXT(Type))
)
Type is the normal picklsit field
What should happen when H is selected.
Those are dummy values.The idea of logic is suffice