Validate if record has changed without checking all fields

We’d like to restrict record edits if the record is of a certain record type and the user is not one of several security profiles. We’d like to do this without having to check each and every one of the 20 or so fields by doing something like this:

ischanged( LastModifiedDate )

As sfdcfox points out in his comment, LastModifiedDate is set when a record is committed to the database, while validation rules run before the commit, therefore this won’t work.

Is there anyway to validate if a record has changed without testing the value of all the objects fields (without APEX)?

Answer

Upon contemplating my problem further, my ultimate goal is to prevent edits of a record unless the user is one of several profiles. Therefore, I don’t particular care if the unauthorized user changed any fields before trying to save the record.

Here’s what I ended up going with:

and
    (
        not(isnew()), 
        RecordType.Name = "My Type",
        $Profile.Name <> "System Administrator", 
        $Profile.Name <> "Support Manager"
    )

If an attempt to edit an existing record of type My Type is made, and the user is not one of the two specified profiles, a validation error is raised. Since I don’t care which fields were changed and I’m only concerned that the record is being edited, this solves my problem.

Attribution
Source : Link , Question Author : Swisher Sweet , Answer Author : Swisher Sweet

Leave a Comment