1

I have a case where we want Closed Opportunities to be read only for a certain profile, with the exception of two fields, Opportunity Owner and a custom field we have (then I also assume I would need to allow LastModifiedDate and LastModifiedBy to be changed).

I don't want to use Record Type/Page Layouts because we already have a bunch of them.

My plan was to use apex to compare the old and new map fields and throw an error if they are different, excluding my list of enumerated fields.

Is there a more elegant way to do this?

1 Answer 1

2

I'm not aware of a more elegant way to do this. The easier, but less effective, way is to use a Validation Rule that requires ISCHANGED() to be true on one of the two fields that you wish to allow to be modified. But that's not a very good solution because it'll still allow other changes to go through provided that one of the enumerated field is also changed.

Apex triggers are one solution, but it comes with a cost - not only user interaction but also automated processes running in the context of the user, or integrations running in the context of the user, are affected.

The other main solution would be building a custom UI in Visualforce or Lightning to prohibit changes based on your specific business requirements. It's more flexible but much more implementation work.

You can't prohibit changes to system audit fields if the record can be modified at all.

1
  • Yeah, that is what I figured. Thank you for your response.
    – awh01
    Jul 3, 2019 at 15:02

You must log in to answer this question.

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