+ Start a Discussion
divingglobaladmindivingglobaladmin 

dynamic "Required" value for field without VF/Apex code

Is it posible to require a field to be non-blank based on an action of a different field on the same page layout via standard SFDC functionality?

 

Use case: I have a Picklist and Picklist (Multi-Select) which combine (logically) to require or not require an entry in a Text field. For example, the Picklist includes: car, truck, plane, boat. The Picklist (Multi-Select) includes: engine, control unit, driver, passenger, luggage. The Text field must be non-blank if Picklist does not = "car" or "truck" AND Picklist (Multi-Select) = "luggage" ONLY

 

Can this be done without VF / Apex code?

 

I tried various combinations of IF / INCLUDES / AND / NOT logic and either I built it wrong or this won't work.

 

TIA!

Best Answer chosen by Admin (Salesforce Developers) 
Ranu JainRanu Jain

Hi

 

Hi,

 

The below formula will also work in validation rule -

 

AND( 

ISBLANK( master_id__c ), 
NOT(OR(ISPICKVAL(single_select_pick_list__c,"Car"), 
ISPICKVAL(single_select_pick_list__c,"Truck"))), 
INCLUDES( Multi_select_pick_list__c , 'luggag') 
)

All Answers

qraishqraish

divingglobaladmin,

 

This was a tricky one.

 

Let me know how it goes, and if it works please mark it as solved for future reference for someone stucked in similar situation,

 

Modified:

 

AND( 
ISBLANK(TextField__c), 
(IF(INCLUDES(PicklistMultiselect__c,'Luggage'),3.14,0) + 
IF(INCLUDES(PicklistMultiselect__c,'Engine'),1,0)+ 
IF(INCLUDES(PicklistMultiselect__c,'Control Unit'),1,0)+ 
IF(INCLUDES(PicklistMultiselect__c,'Driver'),1,0)+ 
IF(INCLUDES(PicklistMultiselect__c,'Passenger'),1,0))= 3.14, 
NOT(OR(ISPICKVAL(PicklistNormal__c,"Car"),ISPICKVAL(PicklistNormal__c,"TRUCK"))) 
)

 

 

Raish

 

 

qraishqraish

Modified.

 

Ranu JainRanu Jain

Hi

 

Hi,

 

The below formula will also work in validation rule -

 

AND( 

ISBLANK( master_id__c ), 
NOT(OR(ISPICKVAL(single_select_pick_list__c,"Car"), 
ISPICKVAL(single_select_pick_list__c,"Truck"))), 
INCLUDES( Multi_select_pick_list__c , 'luggag') 
)

This was selected as the best answer
sandeep@Salesforcesandeep@Salesforce

Very nice post.. Ranu.. keep it up