Apex static メソッドを含むクラスを作成するサンプル

環境
Salesforce

機能
static メソッドを含む Apex クラスを作成します。
名前: AccountUtils
メソッド名: accountsByState
メソッドは、メソッドに渡された州の略号が BillingState と一致するすべての Account オブジェクトの
ID と名前を返す必要があります。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
public class AccountUtils {
public static List<Account>accountsByState(String str){
//AccountオブジェクトIDと名前を取得
List<Account>accList =[SELECT Id,Name FROM Account WHERE billingState =: str];
return accList;
}
}
public class AccountUtils { public static List<Account>accountsByState(String str){ //AccountオブジェクトIDと名前を取得 List<Account>accList =[SELECT Id,Name FROM Account WHERE billingState =: str]; return accList; } }
public class AccountUtils {
    public static List<Account>accountsByState(String str){
       //AccountオブジェクトIDと名前を取得
        List<Account>accList =[SELECT Id,Name FROM Account WHERE billingState =: str];
        return accList;
    }
}

 

Apex

Posted by arkgame