PolygonUtils クラス
緯度と経度の地理位置情報値を使用してサービステリトリーレコード ID を返すために getTerritoryIdByPolygons メソッドを使用した結果を表します。地理コード化された位置がある地図の多角形レコードも返されます。
名前空間
使用方法
PolygonUtils クラスをコールする前に、サービステリトリーに関連付けられた既存の地図の多角形レコードがあることを確認してください。
[Base service appointment territories on polygons (多角形に基づいてサービス予定を設定する)] を有効にしている場合、グローバルアクションはこのクラスを消費してサービス予定の [サービステリトリー] 項目に入力します。標準の FSL グローバルアクションを使用していない場合、getTerritoryIdByPolygons メソッドを使用してオブジェクトの [サービステリトリー] 参照項目に入力できます。
詳細は、「地図の多角形の作成および管理」を参照してください。
PolygonUtils のメソッド
PolygonUtils には、次の静的メソッドが含まれます。
getTerritoryIdByPolygons(longitude, latitude)
署名
static Id getTerritoryIdByPolygons(Double longitude, Double latitude))
パラメータ
戻り値
型: Id
使用方法
このメソッドは、緯度値と経度値からサービステリトリーレコード ID を返します。
例
この例では、緯度と経度の地理位置情報項目を使用してサービステリトリーレコード ID を取得します。
1//fetch Service Appointment record(s)
2List<ServiceAppointment> sas = [select id, latitude, longitude from serviceappointment where appointmentnumber = 'SA-3600' limit 1];
3If(!sas.isEmpty()){
4 //retrieve the service territory record id from the getTerritoryIdByPolygons method using geolocation fields from the first appointment in the list
5 Id ServiceTerritoryId = FSL.PolygonUtils.getTerritoryIdByPolygons(double.valueOf(sas[0].longitude),double.valueOf(sas[0].latitude));
6 system.debug(ServiceTerritoryId);
7}