You need to sign in to do that
Don't have an account?
Sabrent
Method does not exist or incorrect signature: [SET<String>].contains
can someone point out what i am doing wrong, or what is the correct way to find if the picklist field contains any of the mentioned values.
Save error: Method does not exist or incorrect signature: [SET<String>].contains(String, String, String, String, String, String, String)
Schema.DescribeFieldResult F = Object__c.Picklist_Field__c.getDescribe(); List<Schema.PicklistEntry> P = F.getPicklistValues(); set<string> s1 = new set<string>(); for ( Schema.PicklistEntry p1: p){ s1.add(p1.getValue()); system.debug(s1); } if (Field1__c == 0) { if (s1.contains('Support Calls- A','IT Help Desk-L1','IT Help Desk - L2','Support Calls- B','Support Calls- C','Support Calls- D')){ // this is where the error is Total = a.otherField__c ; }
Hi rov,
I think it probably has something to do with the long string you're checking on? Try it with one of the values first and see if that works. You may have to do a few if statements to get through all of the values you want to check for.
I think the contains method can't accept all those values at once.
- Eva
All Answers
Hi - I don't think you need the Set here.
You could try something like:
You've got your picklist values, you just need to loop through them to find the value.
I hope this helps you out.
Eva
s1.containsall(myString) ;
Thanks @ Eva and @Jia
I will try your suggestions and let you know how i go
Eva I tried as you suggested getting the same error
Save error: Method does not exist or incorrect signature: [String].contains(String, String, String, String, String, String, String, String, String, String)
Hi rov,
I think it probably has something to do with the long string you're checking on? Try it with one of the values first and see if that works. You may have to do a few if statements to get through all of the values you want to check for.
I think the contains method can't accept all those values at once.
- Eva
Thanks. you are right, takes only one string value. Appreciate your help and time.
I guess, I will have to do,
if (val.contains('Support Calls- A') || val.contains('Support Calls- B'))