Newer Version Available
Service Report Template
This resource allows users to input one or more service report template IDs, and responds with information about the templates. Service reports can be generated for work orders, work order line items, and service appointments.
ServiceReportTemplate is available to API users in orgs where Field Service is enabled. It is also enabled for Experience Builder sites.
- URI
- /services/data/vXX.X/support/fieldservice/ServiceReportTemplate
- Formats
- JSON
- HTTP Method
- GET
- Authentication
- Authorization: Bearer token
- Parameters
-
Parameter Description templateIds The list of service report template IDs, provided as comma-separated string values. The API response shows a failure if any template ID is invalid. showDefault A boolean parameter indicating whether the default service report template is returned in the response. If true, the default template is included; if false (default), the default template is not included. For example, if a request lists the IDs of two non-default templates and showDefault=true, the response will include information for three templates. templateTypes The type of record that the report template can be used for: ServiceAppointment, WorkOrder, or WorkOrderLineItem. Service report templates include four customizable sub-templates: - WO—Work Order
- WOLI—Work Order Line Item
- WO_SA—Service Appointment for Work Order
- WOLI_SA—Service Appointment for Work Order Line Item
Response Body
A service report has three main areas which cannot be deleted: Header, Body and Footer. Each area must contain at least one component—a section, related list, or signature—though the component can be empty. The Header and Footer come with a predefined section, and additional components cannot be added to them. The Body can contain one or more of each component.
- title: String
- hideTitle: Boolean
- hideFieldLabels: Boolean
- columns: Enum {1, 2}
- rightAlignment: Enum {true,false}
- fields: Array of {Field}
- fieldType: Enum {rta, entityField, blank}
- Attributes:
- If the field type is rta, the field also contains {“richTextValue” : “<html value>”}
- If the field type is entityField, the field also contains {“entityName” : “<WorkOrder>”, “fieldName” : “Account”}
- If the field type is blank, no other information is required
- Position:
- row
- column
- title: String
- hideTitle: Boolean
- entityName: String
- relatedListName: String
- relatedEntityName: String
- fields: Array of {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: Array of {Field Name (String), Position (Row,Column)}
Example
This example request uses two service report template IDs.
- Request
-
GET
/services/data/v42.0/support/fieldservice/ServiceReportTemplate?templateIds=0SLxx0000000ABC, 0SLR000000001QtOAI&showDefault=false&templateTypes=ServiceAppointment
- Response
-
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}