サービスレポートテンプレート
フィールドサービスの 1 つ以上のサービスレポートテンプレートに対応する情報を返します。このリソースは REST API バージョン 40.0 以降で使用できます。
このリソースでは、1 つ以上のサービスレポートテンプレート ID を入力することができ、テンプレートに関する情報を返します。作業指示、作業指示品目、サービス予定のサービスレポートを生成できます。
ServiceReportTemplate は Field Service が有効になっている組織の API ユーザが利用できます。またコミュニティでも有効になっています。
- URI
- /services/data/vXX.X/support/fieldservice/ServiceReportTemplate
- 形式
- JSON
- HTTP メソッド
- GET
- 認証
- Authorization: Bearer token
- パラメータ
-
パラメータ 説明 templateIds サービスレポートテンプレート ID のリスト (カンマ区切りの文字列値)。テンプレート ID が無効の場合、API の応答には失敗が表示されます。 showDefault デフォルトのサービスレポートテンプレートが応答で返されるかどうかを示す boolean パラメータ。true の場合、デフォルトのテンプレートが含まれます。false (デフォルト) の場合、デフォルトのテンプレートは含まれません。たとえば、要求にデフォルト以外の 2 つのテンプレートの ID が含まれていて、showDefault=true である場合、応答には 3 つのテンプレートの情報が含まれます。 templateTypes レポートテンプレートが使用できるレコードタイプは、ServiceAppointment、WorkOrder、WorkOrderLineItem です。サービスレポートには、次の 4 つのサブテンプレートがあります。 - WO — 作業指示
- WOLI — 作業指示品目
- WO_SA — 作業指示のサービス予定
- WOLI_SA — 作業指示品目のサービス予定
レスポンスボディ
サービスレポートには、ヘッダー、本文、フッターという削除できない 3 つの主要領域があります。各領域には、セクション、関連リスト、または署名コンポーネントのうち少なくとも 1 つが含まれている必要がありますが、コンポーネントは空でもかまいません。ヘッダーとフッターには定義済みのセクションが含まれていて、他のコンポーネントを追加することはできません。本文には、各コンポーネントを 1 つ以上含めることができます。
セクションコンポーネントには次のプロパティがあります。
- title: String
- hideTitle: Boolean
- hideFieldLabels: Boolean
- columns: Enum {1, 2}
- rightAlignment: Enum {true,false}
- fields: {Field} の配列
項目は、セクション、関連リスト、署名に追加できます。関連リストの列は、API で項目に変換されます。項目コンポーネントには次のプロパティがあります。
- fieldType: Enum {rta, entityField, blank}
- 属性:
- データ型が rta の場合、項目には {“richTextValue” : “<html value>”} も含まれます。
- データ型が entityField の場合、項目には {“entityName” : “<WorkOrder>”, “fieldName” : “Account”} も含まれます。
- データ型が blank の場合、それ以外に情報は必要ありません。
- 位置:
- row
- column
- title: String
- hideTitle: Boolean
- entityName: String
- relatedListName: String
- relatedEntityName: String
- fields: {Field Name (String), Column Position (Integer)} の配列
署名コンポーネントには次のプロパティがあります。
- title: String
- hideTitle: Boolean
- hideFieldLabels: Boolean
- columns: Enum {1, 2}
- rightAlignment: Enum {true,false}
- signatureType: Dynamic Enum {<technician 1>, <dispatcher 1>}
- fields: {Field Name (String), Position (Row,Column)} の配列
例
この要求���では、2 つのサービスレポートテンプレート ID を使用しています。
- 要求
-
GET
/services/data/v42.0/support/fieldservice/ServiceReportTemplate?templateIds=0SLxx0000000ABC, 0SLR000000001QtOAI&showDefault=false&templateTypes=ServiceAppointment
- 応答
-
1{ 2 "serviceReportTemplates": [ 3 { 4 "defaultTemplate": false, 5 "error": { 6 "errorCode": "INVALID_TEMPLATE_ID", 7 "errorMessage": "The Service Report Template ID is invalid." 8 }, 9 "subTemplates": [], 10 "templateId": "0SLxx0000000ABC" 11 }, 12 { 13 "defaultTemplate": false, 14 "error": null, 15 "subTemplates": [ 16 { 17 "regions": [ 18 { 19 "sections": [ 20 { 21 "columns": 2, 22 "hideFieldLabels": false, 23 "hideTitle": false, 24 "items": [ 25 { 26 "position": { 27 "column": 0, 28 "row": 0 29 }, 30 "richText": "<img alt=\"User-added image\" src=\"https://c.mobile1.content.t.force.com/servlet/rtaImage?eid=0QRR000000008oZ&feoid=Data&refid=0EMR00000000DGK\"></img>", 31 "type": "rta" 32 }, 33 { 34 "position": { 35 "column": 1, 36 "row": 0 37 }, 38 "richText": "<u><i>Salesforce.com</i></u>", 39 "type": "rta" 40 } 41 ], 42 "position": 0, 43 "rightAlign": false, 44 "title": "Service Report", 45 "type": "section" 46 } 47 ], 48 "type": "HEADER" 49 }, 50 { 51 "sections": [ 52 { 53 "columns": 2, 54 "hideFieldLabels": false, 55 "hideTitle": true, 56 "items": [], 57 "position": 0, 58 "rightAlign": false, 59 "showPageNumber": false, 60 "title": "Footer Section", 61 "type": "section" 62 } 63 ], 64 "type": "FOOTER" 65 }, 66 { 67 "sections": [ 68 { 69 "columns": 2, 70 "hideFieldLabels": false, 71 "hideTitle": false, 72 "items": [ 73 { 74 "entityName": "ServiceAppointment", 75 "label": "Account", 76 "name": "AccountId", 77 "position": { 78 "column": 0, 79 "row": 0 80 }, 81 "type": "entityField" 82 }, 83 ... 84 { 85 "position": { 86 "column": 1, 87 "row": 0 88 }, 89 "richText": "Prepared By:", 90 "type": "rta" 91 } 92 ], 93 "position": 0, 94 "rightAlign": false, 95 "title": "Account & Contact Information", 96 "type": "section" 97 }, 98 { 99 "entityName": "WorkOrder", 100 "filterCriteria": { 101 "conditions": [ 102 { 103 "field": "Status", 104 "operation": "includes", 105 "position": 0, 106 "values": [ 107 "In Progress", 108 "Completed" 109 ] 110 } 111 ] 112 }, 113 "hideTitle": false, 114 "items": [ 115 { 116 "column": 0, 117 "label": "Work Order Line Item Number", 118 "name": "LineItemNumber" 119 }, 120 ... 121 { 122 "column": 6, 123 "label": "Unit Price", 124 "name": "UnitPrice" 125 } 126 ], 127 "position": 5, 128 "relatedEntityName": "WorkOrderLineItem", 129 "relatedListName": "WorkOrderLineItems", 130 "title": "Work Order Line Items", 131 "type": "relatedList" 132 }, 133 { 134 "columns": 1, 135 "hideFieldLabels": false, 136 "hideTitle": false, 137 "items": [ 138 { 139 "entityName": "DigitalSignature", 140 "label": "Signature", 141 "name": "Document", 142 "position": { 143 "column": 0, 144 "row": 0 145 }, 146 "type": "entityField" 147 }, 148 { 149 "entityName": "DigitalSignature", 150 "label": "Signed By", 151 "name": "SignedBy", 152 "position": { 153 "column": 0, 154 "row": 1 155 }, 156 "type": "entityField" 157 }, 158 { 159 "entityName": "DigitalSignature", 160 "label": "Date", 161 "name": "SignedDate", 162 "position": { 163 "column": 0, 164 "row": 2 165 }, 166 "type": "entityField" 167 } 168 ], 169 "position": 9, 170 "rightAlign": false, 171 "signatureType": "Default", 172 "signatureTypeLabel": "Default", 173 "title": "Customer Signature", 174 "type": "signature" 175 } 176 ], 177 "type": "BODY" 178 } 179 ], 180 "subTemplateType": "WO_SA" 181 }, 182 { 183 ... 184 "subTemplateType": "WOLI_SA" 185 } 186 ], 187 "templateId": "0SLR000000001QtOAI" 188 } 189 ] 190}