私は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 カスタム フィールドは、1 つまたは複数の値を持つことができます。
例: Feature__c (オブジェクト)
id | Industries__c
a010b00000eERj4 | technology
a010b00000eEYu4 | finance, biotechology
a010b00000eHJj8 | chemical, healthcare
Industry ( defineFeature に渡された値を介して取得されます) が Feature__c の Industries__c の数と等しいかどうかを確認し、応答としてその fetrID を送信します。