0

I am receiving the attached error when I am trying to save an Account record.

Background: - I have created a Multi Select picklist field on Account (Service Partner Type).

On Implementation partner (a) field on Project object, I need to add a criteria so that it filters by "Service Partner Type" includes/contains "Certified Implementation Partner (CIP)". But, I couldn't as it is a multi select picklist value.

Therefore, I have created a checkbox on Account and used a WFR to make it true when Service Partner Type= 'Certified Implementation Partner (CIP)' and I have added this checkbox field as a lookup filter criteria.

Also, whenever Service Partner Type field on Account is populated/updated, Service Partner Type field on Project is populated with the same values. (I used Apex(appended below) to make populate a multi-select picklist field values onto another multi-select picklist field).

Now, when I edit an Account, I receive a field filter validation error appended below.

Error:Apex trigger SCAccountTrigger caused an unexpected exception, contact your administrator: SCAccountTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a2d32000002TCXyAAO; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [Implementation_Partner_Lookup__c]: Class.SCGlobalUtilsClass.UpdateServicePartner: line 543, column 1

public static void UpdateServicePartner(List<Account> acclist){
    Set<Id> accId = new Set<Id>();
    Map<String, String> spmap = new Map<String, String>();
    Map<String, String> spsmap = new Map<String, String>();
    for(Account acc: acclist){
        accId.add(acc.Id);
        system.debug('accId::::::::::::::::'+accId);
    }
    if(!accId.IsEmpty()){
        system.debug('accId::::::::::::::::'+accId);
        for(account a: [Select id, Project_Name__c, Service_Partner_Type__c, Service_Partner_Specialty__c from Account where Id IN: accId]){
            System.debug('a.project name:::::::::::::::'+a.Project_Name__c);
            if(a.Service_Partner_Type__c!= null){
                spmap.put(a.Id, a.Service_Partner_Type__c);
            }
            if(a.Service_Partner_Specialty__c!= null){
                spsmap.put(a.Id, a.Service_Partner_Specialty__c);
            }


        }
    }
    if(!accId.IsEmpty()){
        List<pse__Proj__c> project = new List<pse__Proj__c>();
        for(pse__Proj__c p: [select Id, Service_Partner_Type__c, Service_Partner_Specialty__c, pse__Account__c from pse__Proj__c where pse__Account__c IN: accId]){
            if(p.Service_Partner_Type__c == null && p.pse__Account__c!= null){
                p.Service_Partner_Type__c = spmap.get(p.pse__Account__c);
                system.debug('p.Service_Partner_Type__c::::::::::::::::'+p.Service_Partner_Type__c);
            }
            if(p.Service_Partner_Specialty__c == null && p.pse__Account__c!= null){
                p.Service_Partner_Specialty__c = spsmap.get(p.pse__Account__c);
                system.debug('p.Service_Partner_Specialty__c::::::::::::::::'+p.Service_Partner_Specialty__c);
            }
            project.add(p);
        }
        if(!project.IsEmpty()){
            update project;
        }
    }
}
2
  • what type of help you want? Jan 16 '17 at 3:10
  • How do I overcome this FIELD_FILTER_VALIDATION_EXCEPTION with modifying the lookup filter?
    – Salesforce
    Jan 16 '17 at 3:56
4

Why you are getting this error?

You are trying to update a lookup field which has a Look Up filter added to it. And the value you are providing to that field does not match the Look up filter criteria set on this Look up field.

If you could identify what is the look up criteria and what value you are inserting in code then you can resolve the problem. Find out and this API name in your implementation Implementation_Partner_Lookup__c. Either you make the code compatible with that field filter criteria or change the filter criteria (this in not recommended).

What is lookup field filter?

Below is a stack exchange question link which explains the fact very clearly.
Difference between dependent lookup and lookup filter

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.