0

I have a requirement when record type is "Service_Cases" or "Service_Case_Read_Only" and 'Type' equals "Red Cross Store Support" and 'Status' equals "Closed - Resolved" then 'RCS_Order_Number_1__c' is required.

If not Type, "Red Cross Store Support" and Status not "Closed - Resolved" the 2 fields RCS_Order_Number_1__c and RCS_Order_Number__c are to be BLANK.

Validation Rule Detail

Rule Name Service_Case_Closed_Enter_RCS_Order_Numb

AND(
    RecordType.DeveloperName = "Service_Cases" || RecordType.DeveloperName = "Service_Case_Read_Only",
    ISPICKVAL(Type, "Red Cross Store Support"),
    ISPICKVAL(Status,'Closed - Resolved'),
    ISBLANK( RCS_Order_Number_1__c )
)

This works, BUT still allowed the 'Type' to be changed to other than "Red Cross Store Support" and the 'RCS Order Number' to have a value.

So I created another VR

Rule Name RCS_Order_Number_must_be_blank

AND(
    RecordType.DeveloperName = "Service_Cases" || RecordType.DeveloperName = "Service_Case_Read_Only",
    ISPICKVAL( Status , "Closed - Resolved" ),
    NOT(ISPICKVAL(Type,"Red Cross Store Support")),
    AND(
        OR(
            NOT(ISBLANK( RCS_Order_Number_1__c )),
            NOT(ISBLANK(RCS_Order_Number__c))
        )
    )
)

Problem now is the 'Status' can be changed to another value and the record saves.

Is there an easier way to accomplish my requirement? Where did it go wrong?

0

1 Answer 1

0

You can use PRIORVALUE to reference the original values of fields that are being modified.

You must log in to answer this question.

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