1

I'm trying to have a validation rule to allow 2 profiles to update a date field. it throws an error each time saying the user cannot update the field.

AND(
  NOT(
    ISBLANK(
      PRIORVALUE(IAP_Estimated_End_Date__c)
    )
  ), 
  OR(
    ISCHANGED(IAP_Estimated_End_Date__c), 
    AND(
      $Profile.Id <> "00e41000000XkCJ",
      $Profile.Id <> "00e41000000XkDC"
    )
  )
)

1 Answer 1

2

Your OR should be an AND; you can remove it from the formula:

AND(
  NOT(
    ISBLANK(
      PRIORVALUE(IAP_Estimated_End_Date__c)
    )
  ), 
  ISCHANGED(IAP_Estimated_End_Date__c), 
  $Profile.Id <> "00e41000000XkCJ",
  $Profile.Id <> "00e41000000XkDC"
)

This formula says: "If the previous value was not blank, and the value is changed, and the user's profile is neither of two values, show an error."

You need to remember that OR means "true if either value is true". As such, when ISCHANGED was triggered, the profile ID values were ignored.

P.S. You might want to add a Custom Permission, which would reduce your formula to:

AND(
  NOT(
    ISBLANK(
      PRIORVALUE(IAP_Estimated_End_Date__c)
    )
  ), 
  ISCHANGED(IAP_Estimated_End_Date__c), 
  NOT($Permission.EditIAPEstimatedEndDate)
)
1
  • Thank you it worked!
    – vanessa
    May 30, 2019 at 16:03

You must log in to answer this question.

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