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
Karthikeyan ChandranKarthikeyan Chandran 

Help troubleshooting trigger error with FIELD_FILTER_VALIDATION_EXCEPTION

Hi Team,

I am updating a Opportunity record field from another filed from a custom object, when i update custom field from the custom object am getting FIELD_FILTER_VALIDATION_EXCEPTION error in custom object.

This is the error message that i am getting when i update the custom object record.

Error Message : 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger PrimeBaseRate caused an unexpected exception, contact your administrator: PrimeBaseRate: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 1 with id 006g00000095GZsAAM; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [Existing_Lender__c]: Trigger.PrimeBaseRate: line 26, column 1

Here, the trigger we are using,
 
trigger PrimeBaseRate on Prime_Rate__c (after update, after insert) {

Static Double x;

for(Prime_Rate__c  pr : trigger.new){

x= pr.Prime_Base_Rate__c;

}
System.debug('the vaulue of field is '+x);

//created a new list for bulkifying
list<opportunity> op = new list <opportunity>();

//running for loop for entire table. 
for(opportunity op1 : [select id, Base_Rate__c from opportunity where isclosed=false]){

//changing the value of the field with the static variable. 
op1.Base_Rate__c=x;
op.add(op1);

} 
update op;
}

Can any one modify this code and help me?

Thanks & Regards,
Karthikeyan Chandran
+91-9944676540
 
Best Answer chosen by Karthikeyan Chandran
Nayana PawarNayana Pawar
Hi,

Please check this link:
http://salesforcedeveloperblog.blogspot.in/2011/05/fieldfiltervalidationexception-error.html

This may help you.

All Answers

Nayana PawarNayana Pawar
Hi,

Please check this link:
http://salesforcedeveloperblog.blogspot.in/2011/05/fieldfiltervalidationexception-error.html

This may help you.
This was selected as the best answer
Karthikeyan ChandranKarthikeyan Chandran
Thank you for the response,

Let me check 
Amit Chaudhary 8Amit Chaudhary 8
Hi Karthikeyan,

It look like you added any lookup filter on "Existing_Lender__c" field and you are trying to update field with wrong value. Please check lookup filter and update code accordingly.

Please let us know if this will help u

Thanks,
Amit Chaudhary
Karthikeyan ChandranKarthikeyan Chandran

Amit,

Yes, you are right there is a lookup filter "Existing_Lender__c" in Opportunity object. but in this trigger i am not updating this filter values. Do i need i add this lookup filter "Existing_Lender__c" in Trigger.

Also, there is an another lookup filter in Opportunity, but i don't know why this error on this field only.

Can you change the code here?

Thanks & Regards,
Karthikeyan Chandran
+91-9944676540