PolygonUtils クラス
名前空間
使用方法
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}getAllPolygonsByLatLong(longitude, latitude)
シグネチャー
static List getAllPolygonsByLatLong(Double longitude, Double latitude)
パラメーター
戻り値
型: List<Id>
使用方法
このメソッドは、緯度値と経度値から多角形レコード ID のリストを返します。このメソッドは、共有を含みません。
例
次の例は、関連する多角形の点の経度と緯度の値を含んだリストを取得します。
1//fetch Service Appointment record(s)
2Double longitude = 32.077213;
3Double latitude = 34.792759;
4 List<Polygon__c> relevantPolygons =
5FSL.PolygonUtils.getAllPolygonsByLatLong
6(longitude,latitude);
7 system.debug(relevantPolygons);
8
9}