0

I am not able to use correctly validation rule please help me....

  1. When Status is Not-Confirmed: Room No. shouldn't be selected otherwise room no is must. And Check In and Check out time should be empty.

  2. If Status is Confirmed Room No is must And Check In Time and Check Out Time must be empty.

  3. If Status is Check In Room No is must and Check In Time can't be empty. And Check out time must be empty.

  4. If status is Check Out Room No is must and Check In and Check Out Time can't be empty.

  5. And Check Out time must be greater than check in time.

API Names

Check In Time

Check_In_Time__c

Date/Time Check Out Time

Check_Out_Time__c   

Date/Time Room No Room_No__c Number(15, 0)

Status Status__c Picklist

Booking__c 

Validation Rule

IF(ISPICKVAL( Status__c ,"Not Confirmed"), ISNULL( Room_No__c),False)
6
  • Can you please provide the API names for the object and the fields? Also, what have you tried so far? Show us your attempt/s Mar 7, 2016 at 3:13
  • Check In Time Check_In_Time__c Date/Time Check Out Time Check_Out_Time__c Date/Time Room No Room_No__c Number(15, 0) Status Status__c Picklist
    – user28787
    Mar 7, 2016 at 3:21
  • API Name Booking__c Check In Time, Check_In_Time__c (Date/Time ) , Check Out Time, Check_Out_Time__c(Date/Time ) Room No Room_No__c (Number(15, 0) ) Status Status__c (Picklist)
    – user28787
    Mar 7, 2016 at 3:22
  • 4
    People on here are happy to help when you come up against an issue, but this looks like you're just trying to get everyone to do your job for you. You really need to show us what you've tried and what part of it isn't working. For validation rules, a screenshot of the validation rule will help as well as the actual validation rule.
    – Nick C
    Mar 7, 2016 at 3:40
  • Is it possible to do..
    – user28787
    Mar 7, 2016 at 4:23

1 Answer 1

0

I would do this with five (5) VRs

The first VR is

AND(ISPICKVAL(Status__c,'Not Confirmed'), 
    OR(NOT(ISBLANK(Room_no__c)),        /* w/ room# */
       NOT(ISBLANK(Check_in_time__c)),  /* or w/ checkin date */
       NOT(ISBLANK(Check_out_time__c()  /* or w/ checkout date
      )
   )

Error Message: "Unconfirmed reservations can't have room#, checkin or check out date"

The rest I leave as an exercise to you

A suggestion: complex VRs should be written with each condition on a separate line, adequately commented, with proper indenting to make it easy to debug and/or enhance over time

You must log in to answer this question.

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