我是 SFDC 的新手,我有一个程序,我在其中传递值,我需要将这些值与存在或不存在的自定义对象字段进行比较。
这是我的代码,
public class CheckUtility {
public static ID determineFeature(ID defaultPersonaID, String Email, String Industry, String Title, Decimal Revenue, Integer EmployeeCount) {
ID fetrID = defaultFeatureID;
String emailDomain = Email.split('@').get(1);
Feature__c[] features = new Feature__c[]{};
features = [Select id, Industries__c, Title_Tags__c, Email_Domains__c, Company_Revenue_From__c, Company_Revenue_To__c, Employee_Count_From__c, Employee_Count_To__c FROM Feature__c ORDER BY lastModifiedDate DESC];
Integer industriesFound = 0;
for (feature__c p: features) {
// checking if there is a matching feature based on email
System.debug('Email Domains = ' + p.email_domains__c);
if (p.Email_Domains__c != null &&
p.Email_Domains__c.contains(emailDomain)) {
fetrID = p.ID;
break;
}
if(p.Industries__c != null){
//I am stuck compare the industry is present or not in the p.Industries__c (picklistdatatype)
System.debug('Industries' + p.Industries__c);
fetrID = p.ID;
break;
}
}
return fetrID;
}
}
不,我有 Feature__c 是一个自定义对象。Feature__c.Industries__c 自定义字段可以有一个值或多个值。
例如:Feature__c(对象)
id | Industries__c
a010b00000eERj4 | technology
a010b00000eEYu4 | finance, biotechology
a010b00000eHJj8 | chemical, healthcare
我想检查 Industry (通过在 determineFeature 中传递的值)是否等于 Feature__c 中有多少 Industries__c 并发送他们的 fetrID 作为响应。