0

There is a field CreatedById.

I want to throw an error if there are already values with the same CreatedById values.

How can I write such a validation rule?

1
  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! Please edit your question to add what you have tried (it's OK if it fails) and how it is not working (e.g., exact error text). This site exists to help, not do the work. (From the What topics can I ask about here? section of Help Center: "We’re not a place to exchange code or find implementation services.") Please read more of the Help Center, and also take the Tour.
    – Moonpie
    Sep 8 at 11:49

1 Answer 1

0

Your question is a little ambiguous.

Do you mean one of the following?

1. You want to check other fields on the record for the same value as the CreatedById.

This is pretty straightforward. Your validation rule could look something like this "CreatedById == LastModifiedById". Sub any field for LastModifiedById. You can check multiple fields in one validation rule.

2. You want to see if any other records have the same value for CreatedById. This would not be possible via validation rule. You only have access to the current record(and lookup values). To achieve this you could create a flow or Apex Trigger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.