No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
サポートクラス
サポートクラスを使用すると、営業時間やケースなど、サポートセンターで一般的に使用されるレコードを操作できます。
営業時間の操作
BusinessHours では、複数のタイムゾーンなど、カスタマーサポートチームが活動するさまざまな営業時間を指定することができます。
この例では、startTime から 1 営業時間後の時間を求め、ローカルタイムゾーンで datetime を返します。BusinessHours をクエリすることでデフォルトの営業時間を取得します。BusinessHours add メソッドもコールします。
1// Get the default business hours
2BusinessHours bh = [SELECT Id FROM BusinessHours WHERE IsDefault=true];
3
4// Create Datetime on May 28, 2008 at 1:06:08 AM in local timezone.
5Datetime startTime = Datetime.newInstance(2008, 5, 28, 1, 6, 8);
6
7// Find the time it will be one business hour from May 28, 2008, 1:06:08 AM using the
8// default business hours. The returned Datetime will be in the local timezone.
9Datetime nextTime = BusinessHours.add(bh.id, startTime, 60 * 60 * 1000L);次の例では、startTime から 1 営業時間後の時間を求め、datetime を GMT で返します。
1// Get the default business hours
2BusinessHours bh = [SELECT Id FROM BusinessHours WHERE IsDefault=true];
3
4// Create Datetime on May 28, 2008 at 1:06:08 AM in local timezone.
5Datetime startTime = Datetime.newInstance(2008, 5, 28, 1, 6, 8);
6
7// Find the time it will be one business hour from May 28, 2008, 1:06:08 AM using the
8// default business hours. The returned Datetime will be in GMT.
9Datetime nextTimeGmt = BusinessHours.addGmt(bh.id, startTime, 60 * 60 * 1000L);次の例では、startTime と nextTime の差異を求めます。
1// Get the default business hours
2BusinessHours bh = [select id from businesshours where IsDefault=true];
3
4// Create Datetime on May 28, 2008 at 1:06:08 AM in local timezone.
5Datetime startTime = Datetime.newInstance(2008, 5, 28, 1, 6, 8);
6
7// Create Datetime on May 28, 2008 at 4:06:08 PM in local timezone.
8Datetime endTime = Datetime.newInstance(2008, 5, 28, 16, 6, 8);
9
10// Find the number of business hours milliseconds between startTime and endTime as
11// defined by the default business hours. Will return a negative value if endTime is
12// before startTime, 0 if equal, positive value otherwise.
13Long diff = BusinessHours.diff(bh.id, startTime, endTime);ケースの操作
受信および送信メールメッセージは、Cases クラスの getCaseIdFromEmailThreadId メソッドを使用して対応するケースに関連付けることができます。このメソッドは、顧客から受信したメールをカスタマーサービスケースにする自動化プロセス、メール-to-ケースで使用されます。
次の例では、メールスレッド ID を使用して、関連するケース ID を取得します。
1swfobject.registerObject("clippy.codeblock-3", "9");public class GetCaseIdController {
2
3 public static void getCaseIdSample() {
4 // Get email thread ID
5 String emailThreadId = '_00Dxx1gEW._500xxYktg';
6 // Call Apex method to retrieve case ID from email thread ID
7 ID caseId = Cases.getCaseIdFromEmailThreadId(emailThreadId);
8
9 }
10}