1

I've created validation rules to conditionally make fields required on record type 'Participant' but appears something is off as it is not giving me expected results. Please take a look and let me know the issue. Thanks!

Fields Data Type:

  • Status (picklist)
  • Type (picklist)
  • Reason (picklist)
  • Reason Comments (long text area)

Scenario 1: IF Status = Closed and Type != Null THEN 'Reason' field is required.

VR Condition formula:

AND(
    ISBLANK(TEXT(Reason__c )),
    RecordType.Name = "Participant",
    ISCHANGED(Status__c),
    ISPICKVAL(Status__c,"Closed"),
    OR(
        ISPICKVAL(Type__c , "1"),
        ISPICKVAL(Type__c, "2"),
        ISPICKVAL(Type__c, "3"),
        ISPICKVAL(Type__c, "4")
    )
)

Scenario 2: IF Reason = Win or Loss or Other THEN 'Reason Comments' field is required.

AND(
    ISBLANK(Reason_Comments__c),
    OR(
        ISPICKVAL(Reason__c,"Win" ), 
        ISPICKVAL(Reason__c,"Loss"), 
        ISPICKVAL(Reason__c,"Other")
    )
)
3
  • In your validation rules, do you have the blank handling radio button set to "treat blanks as zeros" or "treat blanks as blanks"? In your first scenario, you're only enforcing it when the status is being changed to closed. Is that what you want to have happen? (it's different from what you describe)
    – Derek F
    Jul 28, 2021 at 19:55
  • Good that you asked. No blank handling radio button is set. I'd really like to know what the condition will look like - 1. If Status is set to Closed and Type is populated 2. If Status changes to 'Closed' from any other Status picklist value and Type is populated. Expectation: Reason field should become required and restrict user from saving the record in both cases.
    – Marci K.
    Jul 28, 2021 at 20:14
  • HI Derek! Your comment help me think through and merely by removing ISCHANGED line from Scenario1 it is working as expected. But Scenario 2 is still not giving me expected results.
    – Marci K.
    Jul 29, 2021 at 13:48

1 Answer 1

0

Scenario 1:

AND(ISBLANK(TEXT(Reason__c )), ISPICKVAL(Status__c,"Closed"), NOT(ISPICKVAL(Type__c, '')))

Now use what you learned from above to give Scenario 2 a try!

3
  • I am receiving an error "Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 1".
    – Marci K.
    Jul 28, 2021 at 20:01
  • Updated to include that. You might also be able to do NOT(ISBLANK(Type__c) but I am not positive. Jul 28, 2021 at 20:36
  • Thanks for your guidance Zack! By removing ISCHANGED line from the formula and adding NOT ISBLANK operator for Type helped me get the desired results but I am still stuck on Scenario 2. It should work with current condition is in place but not sure if anything is off. Can you help? Thanks!
    – Marci K.
    Jul 29, 2021 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .