0

I have created a validation rule to prevent the merge of Contacts from different Accounts, but I get this error:

AND(

NOT(ISBLANK(PRIORVALUE(AccountId))),

NOT(ISBLANK(AccountId)),

PRIORVALUE(AccountId) != AccountId,

IsMerge

)

enter image description here

How can I fix this error?

Is there any other way to prevent the combination of Contacts from different Accounts?

Thank you so much

Mónica Martínez

1 Answer 1

0

As the error is saying IsMerge is not a valid field in Contact object (standard), unless you created a custom field called IsMerge. Your formula seems right, without the IsMerge line.

AND(

NOT(ISBLANK(PRIORVALUE(AccountId))),

NOT(ISBLANK(AccountId)),

PRIORVALUE(AccountId) != AccountId
    
)

This sounds about right, if the Prior AccountId is not equal to the current AccountId. That means, you are trying to change this Contact's account to another account. The above formula will evaluate to true, you can fire the validation rule then. With your own custom message.

4
  • Thank you very much, now there is no error and I can save the validation rule, but it does not work. I can carry out the process of combining two or more contacts from different Accounts, so it doesn't work for me. I will have to look for an alternative/solution.
    – Mónica
    Nov 18, 2023 at 10:22
  • Is the validation rule activated? and by the way, you want this validation rule to fire, when the user is trying to change the Account lookup field in Contact record right? Meaning if user is changing a Contact's Account lookup from Account A -> Account B, then this validation rule should fire/prevent user from changing?
    – prem22
    Nov 18, 2023 at 10:32
  • Yeah, the validation rule is active, the first thing I have done is to check it. Effectively, I want that when the user is in the Potential Duplicate Records screen and click on Next button, the error will appear and they will not be able to do the merge.
    – Mónica
    Nov 18, 2023 at 10:49
  • By the way I just tried the following validation rule personally. It does not allow me to change Account of a Contact record, when I edit the Contact record and change the Account field, it fires the validation rule. Do you have a duplicate rule setup on it?
    – prem22
    Nov 18, 2023 at 14:44

You must log in to answer this question.

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