You need to sign in to do that
Don't have an account?

Error related to validation rule?
Hi. I created a validation rule that WORKS, but it appears to be causing an error in another area in Salesforce.
The validation rule:
Basically, if a donation (opportunity record) is entered, the “classification” multi-picklist field must CONTAIN more than 1 value if “Anonymous” is selected. (Hooray, it works!)
Because we’re a nonprofit, we enabled the native “matching gift” functionality. When trying to match gifts, the validation rule error appears.
I looked at 2 individual donations (opportunity records) and BOTH contain “anonymous AND individual”. They follow the validation rule criteria. When I look at the URL of the “Matching Gift” page, it contains…
visual.force.com/apex/
Which makes me think this has something to due with Visualforce or Apex? I’m not sure what to look at to fix this error altogether.
Thank you for your help!
Validation Rule for Reference:
AND(
NOT(INCLUDES(Donation_Classification__c,"Corporate")),
NOT(INCLUDES(Donation_Classification__c,"Foundation")),
NOT(INCLUDES(Donation_Classification__c,"In-Direct Public Support")),
NOT(INCLUDES(Donation_Classification__c,"Band Fees")),
NOT(INCLUDES(Donation_Classification__c,"In-Kind Donations")),
NOT(INCLUDES(Donation_Classification__c,"Board Contribution")),
NOT(INCLUDES(Donation_Classification__c,"Individual")),
INCLUDES(Donation_Classification__c,"Anonymous")
)
Error Message: The "Donation Classification" must contain an additional selection. Example: Anonymous AND Individual
REPLY FROM SUCCESS COMMUNITY:
The reason Apex appear in the URL is because the Salesforce non-profit pack is not actually native functionality in the system - it is an application incorporated into Salesforce. All custom Visualforce pages have /apex/ in the URL.
With that being said, it is also the reason I doubt anyone here could help resolve the issue. This page likely tries to create a new record that breaks your validation, and seeing as it is impossible to modify (or even examine) it's code, we can't tell whether the page inserts some sort of value we can use to make the validation rule ignore operations from this page.
It may be possible to write a Before Insert Apex trigger that identifies the page the user is on, and fill in some field to make the validation rule skip it.
Thank you for your help!
I am sure folks here myself included can help you write such a trigger.
Trigger
Test class
Cratete a worflow rule or process builder with rule entry and field update ...
Since you can't: is there any field set, custom setting, or custom metadata that lets you define the fields that appear in that matching gift UI? (Sorry, not terribly familiar with the nonprofit kit). Adding your custom field to that configuration MIGHT enable the controller for the page to see your field value and insert a valid cloned record.
Still, I'd guess that's your best bet. If you have no control over that page - even the columns - I'm not sure what I would suggest next, except to raise it with Salesforce. One thing I'll say: if you can't configure this such that you can create a validation rule, the feature isn't written using best practices for defensive coding (meaning: it's too easy to break via very reasonable extension/configuration, so it's worth raising the issue).