function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abby Hayes Abby HayesAbby Hayes Abby Hayes 

Apex classes causing problems with saving new contacts

Hi, 

I am having issues with contacts throwing a validation error once a in a while. Usually, we can get the contact to save, but only by removing either the Mailing City or Mailing State. There doesn't seem to be a pattern to the behavior. I contacted support, but they couldn't help me because the issue seems to be related to Apex Classes. Here's what the tech said:

As i investigated from my end and i can see -
1. There are no validation rules for contact and account
2. No workflow related to field (mailing city)
3. But i can see that there are many apex classes related to contact object and you need to check those apex classes, as we are not permitted to make any changes in you org.

We don't have an internal developer. And while we do have budget for some external development hours, I am wondering if there is a potentially simple fix for this issue. Can anyone let me know where to begin troubleshooting? I know how to use a sandbox and could potentially start working things out there.

Any advice is much appreciated! Thanks!
v varaprasadv varaprasad
Hi Abby,

Which error you are receiving at the time of saving the record.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
 
Abby Hayes Abby HayesAbby Hayes Abby Hayes
The error is just this:

A validation rule is preventing the record from saving: Use one of these records?

But like the support person recognized, there actually aren't any validation rules on either mailing state or mailing city.
Mouhamed N'DIONGUEMouhamed N'DIONGUE
Hi,

Could you just check in your apex class as they told you. In fact, the "validation rule" can be implemanted programmatocally using for example addError. And in this case, you really need to go through the code to see it. You can begin by triggers of your Account/contact transaction.

Regards
Mouhamed