3

I have field Application_type__c on lead object which is multiselect picklist. I want to exclude records where picklist value is No application' or 'Global Markets or Blank.

My query is

Select Id, Name,Application_type__c , Lead_Age_Days__c from Lead 
                                where isConverted = false
                                and (
                                    (LeadSource = 'Client-Portal-Lead' and Client_Portal_Stage__c = 'Page2 Completed') 
                                    or (LeadSource = 'Client-Portal-Lead-Ar' and Client_Portal_Stage__c = 'Page2 Completed') 
                                    or (LeadSource = 'Manual entry' and Client_Portal_Stage__c = null)
                                    ) 
                                and Entity__c = 'Abu Dhabi' 
                                and CST_Owner__c = null 
                                and Application_type__c excludes ('No application','Global Markets') 
                                ORDER BY CreatedDate ASC

I get required result + Record where this field is blank or NULL.

If I change

Application_type__c excludes ('No application','Global Markets') to

Application_type__c excludes ('No application','Global Markets','') 

It gives results with No application as well.

How can I exclude record where this field is NULL or blank

2
  • Have you tried using "Application_type__c != 'No application' AND Application_type__c != 'Global Markets'" to see if the result is still the same? Nov 5 '15 at 14:25
  • @RenatoOliveira , that was the first thing i tried, it will not work in case of multi select picklist
    – C0DEPirate
    Nov 6 '15 at 5:40
4

Since Application_type__c is apparently a multi-select picklist which are also of Type string, it would seem you'd want to specify

Application_type__c excludes ('No application','Global Markets') AND !Application_type__c.isEmpty()

string.isEmpty() tests for both empty strings and strings with a value of null.

1
  • Thank you @crmprogdev. Working fine with your solution : Select Id, Name,Application_type__c , Lead_Age_Days__c from Lead where isConverted = false and ( (LeadSource = 'Client-Portal-Lead' and Client_Portal_Stage__c = 'Page2 Completed') or (LeadSource = 'Client-Portal-Lead-Ar' and Client_Portal_Stage__c = 'Page2 Completed') or (LeadSource = 'Manual entry' and Client_Portal_Stage__c = null) ) and Entity__c = 'Abu Dhabi' and CST_Owner__c = null and Application_type__c excludes ('No application','Global Markets') and Application_type__c !='' ORDER BY CreatedDate ASC
    – C0DEPirate
    Nov 6 '15 at 5:45

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.