@rippling/rippling-sdk 0.2.0-alpha.61 → 0.2.0-alpha.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.mts +18 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +18 -0
- package/client.d.ts.map +1 -1
- package/client.js +18 -0
- package/client.js.map +1 -1
- package/client.mjs +18 -0
- package/client.mjs.map +1 -1
- package/examples/manifest/field-service-dispatch/field-service-dispatch.ts +530 -0
- package/examples/manifest/grant-program-management/grant-program-management.ts +594 -0
- package/examples/manifest/procurement-approval-hub/procurement-approval-hub.ts +554 -0
- package/lib/manifest/custom-object-page-layout.d.mts +0 -6
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +0 -6
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +16 -5
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +16 -5
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/index.d.mts +1 -1
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +1 -1
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/app-users.d.mts +186 -0
- package/resources/app-users.d.mts.map +1 -0
- package/resources/app-users.d.ts +186 -0
- package/resources/app-users.d.ts.map +1 -0
- package/resources/app-users.js +32 -0
- package/resources/app-users.js.map +1 -0
- package/resources/app-users.mjs +28 -0
- package/resources/app-users.mjs.map +1 -0
- package/resources/device-orders.d.mts +147 -0
- package/resources/device-orders.d.mts.map +1 -0
- package/resources/device-orders.d.ts +147 -0
- package/resources/device-orders.d.ts.map +1 -0
- package/resources/device-orders.js +34 -0
- package/resources/device-orders.js.map +1 -0
- package/resources/device-orders.mjs +30 -0
- package/resources/device-orders.mjs.map +1 -0
- package/resources/devices.d.mts +272 -0
- package/resources/devices.d.mts.map +1 -0
- package/resources/devices.d.ts +272 -0
- package/resources/devices.d.ts.map +1 -0
- package/resources/devices.js +32 -0
- package/resources/devices.js.map +1 -0
- package/resources/devices.mjs +28 -0
- package/resources/devices.mjs.map +1 -0
- package/resources/functions/deployments.d.mts +8 -0
- package/resources/functions/deployments.d.mts.map +1 -1
- package/resources/functions/deployments.d.ts +8 -0
- package/resources/functions/deployments.d.ts.map +1 -1
- package/resources/index.d.mts +3 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +8 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/job-assignments.d.mts +12 -12
- package/resources/job-assignments.d.mts.map +1 -1
- package/resources/job-assignments.d.ts +12 -12
- package/resources/job-assignments.d.ts.map +1 -1
- package/resources/workers.d.mts +13 -0
- package/resources/workers.d.mts.map +1 -1
- package/resources/workers.d.ts +13 -0
- package/resources/workers.d.ts.map +1 -1
- package/src/client.ts +66 -0
- package/src/lib/manifest/custom-object-page-layout.ts +14 -9
- package/src/lib/manifest/index.ts +0 -2
- package/src/resources/app-users.ts +270 -0
- package/src/resources/device-orders.ts +200 -0
- package/src/resources/devices.ts +496 -0
- package/src/resources/functions/deployments.ts +10 -0
- package/src/resources/index.ts +24 -0
- package/src/resources/job-assignments.ts +12 -12
- package/src/resources/workers.ts +15 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Field Service Dispatch - customers, assets, work orders, tasks, and parts.
|
|
3
|
+
*
|
|
4
|
+
* fs_customer_site__c <- customer location and service tier
|
|
5
|
+
* fs_asset__c <- equipment installed at a customer site
|
|
6
|
+
* fs_work_order__c <- dispatch job for a site and optional asset
|
|
7
|
+
* fs_task__c <- checklist/labor line on a work order
|
|
8
|
+
* fs_part_usage__c <- parts consumed by a task
|
|
9
|
+
*
|
|
10
|
+
* Run:
|
|
11
|
+
* yarn tsn examples/manifest/field-service-dispatch/field-service-dispatch.ts \
|
|
12
|
+
* > examples/manifest/field-service-dispatch/manifest.json
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
Category,
|
|
17
|
+
CustomObject,
|
|
18
|
+
CustomObjectFieldSection,
|
|
19
|
+
CustomObjectPageLayout,
|
|
20
|
+
DateField,
|
|
21
|
+
DatetimeField,
|
|
22
|
+
FormulaField,
|
|
23
|
+
ListViewDef,
|
|
24
|
+
LongTextField,
|
|
25
|
+
LookupField,
|
|
26
|
+
ManifestBuilder,
|
|
27
|
+
NumberField,
|
|
28
|
+
ParentChildField,
|
|
29
|
+
Rule,
|
|
30
|
+
SelectField,
|
|
31
|
+
SummaryField,
|
|
32
|
+
TextField,
|
|
33
|
+
Validation,
|
|
34
|
+
} from '@rippling/rippling-sdk/lib/manifest';
|
|
35
|
+
|
|
36
|
+
const manifest = new ManifestBuilder({
|
|
37
|
+
key: 'field_service_dispatch',
|
|
38
|
+
name: 'Field Service Dispatch',
|
|
39
|
+
description: 'Dispatch work orders across customer sites, installed assets, tasks, and consumed parts',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const category = new Category(manifest, {
|
|
43
|
+
apiName: 'field_service__c',
|
|
44
|
+
name: 'Field service',
|
|
45
|
+
description: 'Service operations and dispatch records',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const siteObj = new CustomObject(manifest, {
|
|
49
|
+
apiName: 'fs_customer_site__c',
|
|
50
|
+
name: 'Customer site',
|
|
51
|
+
pluralLabel: 'Customer sites',
|
|
52
|
+
category,
|
|
53
|
+
description: 'Customer location with service tier and access notes',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const siteSection = new CustomObjectFieldSection(siteObj, {
|
|
57
|
+
name: 'Site',
|
|
58
|
+
sectionId: 'sec_fs_site',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const siteAccountField = new TextField(siteObj, {
|
|
62
|
+
apiName: 'account_name__c',
|
|
63
|
+
displayName: 'Account name',
|
|
64
|
+
description: 'Customer account or property group',
|
|
65
|
+
required: true,
|
|
66
|
+
maxLength: 160,
|
|
67
|
+
section: siteSection,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const siteAddressField = new LongTextField(siteObj, {
|
|
71
|
+
apiName: 'service_address__c',
|
|
72
|
+
displayName: 'Service address',
|
|
73
|
+
description: 'Address, gate code, and arrival instructions',
|
|
74
|
+
maxLength: 3000,
|
|
75
|
+
section: siteSection,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const siteTierField = new SelectField(siteObj, {
|
|
79
|
+
apiName: 'service_tier__c',
|
|
80
|
+
displayName: 'Service tier',
|
|
81
|
+
description: 'SLA tier for dispatch prioritization',
|
|
82
|
+
options: ['Standard', 'Premium', 'Critical 24x7'],
|
|
83
|
+
required: true,
|
|
84
|
+
section: siteSection,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const assetObj = new CustomObject(manifest, {
|
|
88
|
+
apiName: 'fs_asset__c',
|
|
89
|
+
name: 'Asset',
|
|
90
|
+
pluralLabel: 'Assets',
|
|
91
|
+
category,
|
|
92
|
+
description: 'Installed equipment maintained at a customer site',
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const assetSection = new CustomObjectFieldSection(assetObj, {
|
|
96
|
+
name: 'Asset',
|
|
97
|
+
sectionId: 'sec_fs_asset',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const assetSiteRef = new ParentChildField(assetObj, {
|
|
101
|
+
apiName: 'customer_site_ref__c',
|
|
102
|
+
displayName: 'Customer site',
|
|
103
|
+
target: siteObj,
|
|
104
|
+
relatedDataLabel: 'Assets',
|
|
105
|
+
parentChildType: 'PRIMARY',
|
|
106
|
+
enableParentOwnerInheritance: false,
|
|
107
|
+
description: 'Site where this asset is installed',
|
|
108
|
+
section: assetSection,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const assetSerialField = new TextField(assetObj, {
|
|
112
|
+
apiName: 'serial_number__c',
|
|
113
|
+
displayName: 'Serial number',
|
|
114
|
+
description: 'Manufacturer serial number',
|
|
115
|
+
maxLength: 80,
|
|
116
|
+
section: assetSection,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const assetTypeField = new SelectField(assetObj, {
|
|
120
|
+
apiName: 'asset_type__c',
|
|
121
|
+
displayName: 'Asset type',
|
|
122
|
+
description: 'Equipment category',
|
|
123
|
+
options: ['HVAC', 'Generator', 'Security', 'Network', 'Kitchen equipment', 'Other'],
|
|
124
|
+
required: true,
|
|
125
|
+
section: assetSection,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const assetWarrantyEndField = new DateField(assetObj, {
|
|
129
|
+
apiName: 'warranty_end__c',
|
|
130
|
+
displayName: 'Warranty end',
|
|
131
|
+
description: 'Warranty expiration date',
|
|
132
|
+
section: assetSection,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const workOrderObj = new CustomObject(manifest, {
|
|
136
|
+
apiName: 'fs_work_order__c',
|
|
137
|
+
name: 'Work order',
|
|
138
|
+
pluralLabel: 'Work orders',
|
|
139
|
+
category,
|
|
140
|
+
description: 'Dispatch job with schedule, priority, and status',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const workOrderSection = new CustomObjectFieldSection(workOrderObj, {
|
|
144
|
+
name: 'Work order',
|
|
145
|
+
sectionId: 'sec_fs_work_order',
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const workOrderSiteRef = new ParentChildField(workOrderObj, {
|
|
149
|
+
apiName: 'customer_site_ref__c',
|
|
150
|
+
displayName: 'Customer site',
|
|
151
|
+
target: siteObj,
|
|
152
|
+
relatedDataLabel: 'Work orders',
|
|
153
|
+
parentChildType: 'PRIMARY',
|
|
154
|
+
enableParentOwnerInheritance: false,
|
|
155
|
+
description: 'Site receiving service',
|
|
156
|
+
section: workOrderSection,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const workOrderAssetRef = new LookupField(workOrderObj, {
|
|
160
|
+
apiName: 'asset_ref__c',
|
|
161
|
+
displayName: 'Asset',
|
|
162
|
+
target: assetObj,
|
|
163
|
+
relatedDataLabel: 'Work orders',
|
|
164
|
+
description: 'Optional installed asset being serviced',
|
|
165
|
+
section: workOrderSection,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const workOrderPriorityField = new SelectField(workOrderObj, {
|
|
169
|
+
apiName: 'priority__c',
|
|
170
|
+
displayName: 'Priority',
|
|
171
|
+
description: 'Dispatch priority',
|
|
172
|
+
options: ['Low', 'Normal', 'High', 'Emergency'],
|
|
173
|
+
required: true,
|
|
174
|
+
section: workOrderSection,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const workOrderStatusField = new SelectField(workOrderObj, {
|
|
178
|
+
apiName: 'status__c',
|
|
179
|
+
displayName: 'Status',
|
|
180
|
+
description: 'Current dispatch status',
|
|
181
|
+
options: ['New', 'Scheduled', 'In progress', 'Blocked', 'Complete', 'Cancelled'],
|
|
182
|
+
required: true,
|
|
183
|
+
section: workOrderSection,
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const workOrderScheduledStartField = new DatetimeField(workOrderObj, {
|
|
187
|
+
apiName: 'scheduled_start__c',
|
|
188
|
+
displayName: 'Scheduled start',
|
|
189
|
+
description: 'Planned arrival window start',
|
|
190
|
+
section: workOrderSection,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const workOrderScheduledEndField = new DatetimeField(workOrderObj, {
|
|
194
|
+
apiName: 'scheduled_end__c',
|
|
195
|
+
displayName: 'Scheduled end',
|
|
196
|
+
description: 'Planned arrival window end',
|
|
197
|
+
section: workOrderSection,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const workOrderSummaryField = new LongTextField(workOrderObj, {
|
|
201
|
+
apiName: 'problem_summary__c',
|
|
202
|
+
displayName: 'Problem summary',
|
|
203
|
+
description: 'Customer-reported issue and triage notes',
|
|
204
|
+
maxLength: 6000,
|
|
205
|
+
section: workOrderSection,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const taskObj = new CustomObject(manifest, {
|
|
209
|
+
apiName: 'fs_task__c',
|
|
210
|
+
name: 'Task',
|
|
211
|
+
pluralLabel: 'Tasks',
|
|
212
|
+
category,
|
|
213
|
+
description: 'Work order task with labor estimate and completion state',
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const taskSection = new CustomObjectFieldSection(taskObj, {
|
|
217
|
+
name: 'Task',
|
|
218
|
+
sectionId: 'sec_fs_task',
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const taskWorkOrderRef = new ParentChildField(taskObj, {
|
|
222
|
+
apiName: 'work_order_ref__c',
|
|
223
|
+
displayName: 'Work order',
|
|
224
|
+
target: workOrderObj,
|
|
225
|
+
relatedDataLabel: 'Tasks',
|
|
226
|
+
parentChildType: 'PRIMARY',
|
|
227
|
+
enableParentOwnerInheritance: true,
|
|
228
|
+
description: 'Work order this task belongs to',
|
|
229
|
+
section: taskSection,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const taskTypeField = new SelectField(taskObj, {
|
|
233
|
+
apiName: 'task_type__c',
|
|
234
|
+
displayName: 'Task type',
|
|
235
|
+
description: 'Type of work required',
|
|
236
|
+
options: ['Inspect', 'Repair', 'Replace', 'Calibrate', 'Clean', 'Customer walkthrough'],
|
|
237
|
+
required: true,
|
|
238
|
+
section: taskSection,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const taskStatusField = new SelectField(taskObj, {
|
|
242
|
+
apiName: 'status__c',
|
|
243
|
+
displayName: 'Status',
|
|
244
|
+
description: 'Task status',
|
|
245
|
+
options: ['Open', 'In progress', 'Blocked', 'Done'],
|
|
246
|
+
required: true,
|
|
247
|
+
section: taskSection,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const taskEstimatedHoursField = new NumberField(taskObj, {
|
|
251
|
+
apiName: 'estimated_hours__c',
|
|
252
|
+
displayName: 'Estimated hours',
|
|
253
|
+
description: 'Labor estimate for this task',
|
|
254
|
+
decimalPlaces: 2,
|
|
255
|
+
section: taskSection,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
const taskCompletedAtField = new DatetimeField(taskObj, {
|
|
259
|
+
apiName: 'completed_at__c',
|
|
260
|
+
displayName: 'Completed at',
|
|
261
|
+
description: 'Completion timestamp',
|
|
262
|
+
section: taskSection,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const partUsageObj = new CustomObject(manifest, {
|
|
266
|
+
apiName: 'fs_part_usage__c',
|
|
267
|
+
name: 'Part usage',
|
|
268
|
+
pluralLabel: 'Part usage',
|
|
269
|
+
category,
|
|
270
|
+
description: 'Part consumed while completing a task',
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const partUsageSection = new CustomObjectFieldSection(partUsageObj, {
|
|
274
|
+
name: 'Part usage',
|
|
275
|
+
sectionId: 'sec_fs_part_usage',
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const partTaskRef = new ParentChildField(partUsageObj, {
|
|
279
|
+
apiName: 'task_ref__c',
|
|
280
|
+
displayName: 'Task',
|
|
281
|
+
target: taskObj,
|
|
282
|
+
relatedDataLabel: 'Parts used',
|
|
283
|
+
parentChildType: 'PRIMARY',
|
|
284
|
+
enableParentOwnerInheritance: true,
|
|
285
|
+
description: 'Task that consumed this part',
|
|
286
|
+
section: partUsageSection,
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const partSkuField = new TextField(partUsageObj, {
|
|
290
|
+
apiName: 'sku__c',
|
|
291
|
+
displayName: 'SKU',
|
|
292
|
+
description: 'Inventory SKU or part number',
|
|
293
|
+
maxLength: 80,
|
|
294
|
+
required: true,
|
|
295
|
+
section: partUsageSection,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const partQuantityField = new NumberField(partUsageObj, {
|
|
299
|
+
apiName: 'quantity__c',
|
|
300
|
+
displayName: 'Quantity',
|
|
301
|
+
description: 'Quantity consumed',
|
|
302
|
+
decimalPlaces: 2,
|
|
303
|
+
required: true,
|
|
304
|
+
section: partUsageSection,
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const partCostCentsField = new NumberField(partUsageObj, {
|
|
308
|
+
apiName: 'unit_cost_cents__c',
|
|
309
|
+
displayName: 'Unit cost (cents)',
|
|
310
|
+
description: 'Unit material cost in cents',
|
|
311
|
+
decimalPlaces: 0,
|
|
312
|
+
section: partUsageSection,
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
const assetCountOnSite = new SummaryField(siteObj, {
|
|
316
|
+
apiName: 'asset_count__c',
|
|
317
|
+
displayName: 'Assets',
|
|
318
|
+
aggregates: assetSerialField,
|
|
319
|
+
using: 'COUNT',
|
|
320
|
+
lookup: assetSiteRef,
|
|
321
|
+
description: 'Installed asset count',
|
|
322
|
+
section: siteSection,
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
const workOrderCountOnSite = new SummaryField(siteObj, {
|
|
326
|
+
apiName: 'work_order_count__c',
|
|
327
|
+
displayName: 'Work orders',
|
|
328
|
+
aggregates: workOrderStatusField,
|
|
329
|
+
using: 'COUNT',
|
|
330
|
+
lookup: workOrderSiteRef,
|
|
331
|
+
description: 'Work orders associated with this site',
|
|
332
|
+
section: siteSection,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
const taskCountOnWorkOrder = new SummaryField(workOrderObj, {
|
|
336
|
+
apiName: 'task_count__c',
|
|
337
|
+
displayName: 'Tasks',
|
|
338
|
+
aggregates: taskTypeField,
|
|
339
|
+
using: 'COUNT',
|
|
340
|
+
lookup: taskWorkOrderRef,
|
|
341
|
+
description: 'Task count on this work order',
|
|
342
|
+
section: workOrderSection,
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const estimatedHoursOnWorkOrder = new SummaryField(workOrderObj, {
|
|
346
|
+
apiName: 'estimated_hours_total__c',
|
|
347
|
+
displayName: 'Estimated hours total',
|
|
348
|
+
aggregates: taskEstimatedHoursField,
|
|
349
|
+
using: 'SUM',
|
|
350
|
+
lookup: taskWorkOrderRef,
|
|
351
|
+
description: 'Total estimated labor hours',
|
|
352
|
+
section: workOrderSection,
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
const partsCountOnTask = new SummaryField(taskObj, {
|
|
356
|
+
apiName: 'parts_count__c',
|
|
357
|
+
displayName: 'Parts lines',
|
|
358
|
+
aggregates: partSkuField,
|
|
359
|
+
using: 'COUNT',
|
|
360
|
+
lookup: partTaskRef,
|
|
361
|
+
description: 'Number of part usage lines',
|
|
362
|
+
section: taskSection,
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const workOrderLabelField = new FormulaField(workOrderObj, {
|
|
366
|
+
apiName: 'dispatch_label__c',
|
|
367
|
+
displayName: 'Dispatch label',
|
|
368
|
+
description: 'Compact board label',
|
|
369
|
+
fieldType: 'TEXT',
|
|
370
|
+
maxLength: 240,
|
|
371
|
+
formula: "CONCATENATE(priority__c, ' - ', status__c)",
|
|
372
|
+
section: workOrderSection,
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
new Validation(workOrderObj, {
|
|
376
|
+
ruleId: 'fs_work_order_window_valid',
|
|
377
|
+
displayName: 'Scheduled end must be after start',
|
|
378
|
+
rqlFormula: '(scheduled_end__c <= scheduled_start__c)',
|
|
379
|
+
errorMessage: 'Scheduled end must be after scheduled start.',
|
|
380
|
+
ruleDescription: 'Prevents inverted dispatch windows',
|
|
381
|
+
state: 'ACTIVE',
|
|
382
|
+
level: 'FIELD',
|
|
383
|
+
fieldRef: workOrderScheduledEndField,
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
new Validation(partUsageObj, {
|
|
387
|
+
ruleId: 'fs_part_quantity_positive',
|
|
388
|
+
displayName: 'Quantity must be positive',
|
|
389
|
+
rqlFormula: '(quantity__c <= 0)',
|
|
390
|
+
errorMessage: 'Quantity must be greater than zero.',
|
|
391
|
+
ruleDescription: 'Blocks zero or negative parts usage',
|
|
392
|
+
state: 'ACTIVE',
|
|
393
|
+
level: 'FIELD',
|
|
394
|
+
fieldRef: partQuantityField,
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
new Rule(workOrderObj, {
|
|
398
|
+
flowId: 'fs_default_work_order_status',
|
|
399
|
+
flowName: 'Default work order status',
|
|
400
|
+
triggerType: 'CREATE',
|
|
401
|
+
description: 'New work orders start in New status',
|
|
402
|
+
actions: [{ targetField: workOrderStatusField, fixedValue: ['New'] }],
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
new Rule(taskObj, {
|
|
406
|
+
flowId: 'fs_default_task_status',
|
|
407
|
+
flowName: 'Default task status',
|
|
408
|
+
triggerType: 'CREATE',
|
|
409
|
+
description: 'New tasks start Open',
|
|
410
|
+
actions: [{ targetField: taskStatusField, fixedValue: ['Open'] }],
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
new ListViewDef(siteObj, {
|
|
414
|
+
viewId: 'view_fs_customer_sites',
|
|
415
|
+
name: 'Customer sites',
|
|
416
|
+
description: 'Sites with service tier, assets, and work order volume',
|
|
417
|
+
fields: ['name', siteAccountField, siteTierField, assetCountOnSite, workOrderCountOnSite],
|
|
418
|
+
orderBy: 'name',
|
|
419
|
+
sortOrder: 'ASC',
|
|
420
|
+
isPublic: true,
|
|
421
|
+
objectScope: 'all',
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
new ListViewDef(assetObj, {
|
|
425
|
+
viewId: 'view_fs_assets',
|
|
426
|
+
name: 'Assets',
|
|
427
|
+
description: 'Installed equipment by site',
|
|
428
|
+
fields: ['name', assetSiteRef, assetTypeField, assetSerialField, assetWarrantyEndField],
|
|
429
|
+
orderBy: 'name',
|
|
430
|
+
sortOrder: 'ASC',
|
|
431
|
+
isPublic: true,
|
|
432
|
+
objectScope: 'all',
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
new ListViewDef(workOrderObj, {
|
|
436
|
+
viewId: 'view_fs_work_orders',
|
|
437
|
+
name: 'Work orders',
|
|
438
|
+
description: 'Dispatch board with schedule and rollups',
|
|
439
|
+
fields: [
|
|
440
|
+
'name',
|
|
441
|
+
workOrderSiteRef,
|
|
442
|
+
workOrderAssetRef,
|
|
443
|
+
workOrderPriorityField,
|
|
444
|
+
workOrderStatusField,
|
|
445
|
+
workOrderScheduledStartField,
|
|
446
|
+
taskCountOnWorkOrder,
|
|
447
|
+
estimatedHoursOnWorkOrder,
|
|
448
|
+
workOrderLabelField,
|
|
449
|
+
],
|
|
450
|
+
orderBy: workOrderScheduledStartField,
|
|
451
|
+
sortOrder: 'ASC',
|
|
452
|
+
isPublic: true,
|
|
453
|
+
objectScope: 'all',
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
new ListViewDef(taskObj, {
|
|
457
|
+
viewId: 'view_fs_tasks',
|
|
458
|
+
name: 'Tasks',
|
|
459
|
+
description: 'Task checklist with estimates and parts lines',
|
|
460
|
+
fields: [
|
|
461
|
+
'name',
|
|
462
|
+
taskWorkOrderRef,
|
|
463
|
+
taskTypeField,
|
|
464
|
+
taskStatusField,
|
|
465
|
+
taskEstimatedHoursField,
|
|
466
|
+
partsCountOnTask,
|
|
467
|
+
],
|
|
468
|
+
orderBy: taskWorkOrderRef,
|
|
469
|
+
sortOrder: 'ASC',
|
|
470
|
+
isPublic: true,
|
|
471
|
+
objectScope: 'all',
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
new ListViewDef(partUsageObj, {
|
|
475
|
+
viewId: 'view_fs_part_usage',
|
|
476
|
+
name: 'Part usage',
|
|
477
|
+
description: 'Parts consumed by service tasks',
|
|
478
|
+
fields: ['name', partTaskRef, partSkuField, partQuantityField, partCostCentsField],
|
|
479
|
+
orderBy: partTaskRef,
|
|
480
|
+
sortOrder: 'ASC',
|
|
481
|
+
isPublic: true,
|
|
482
|
+
objectScope: 'all',
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
CustomObjectPageLayout.basic(siteObj, {
|
|
486
|
+
section: siteSection,
|
|
487
|
+
fields: ['name', siteAccountField, siteAddressField, siteTierField, assetCountOnSite, workOrderCountOnSite],
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
CustomObjectPageLayout.basic(assetObj, {
|
|
491
|
+
section: assetSection,
|
|
492
|
+
fields: ['name', assetSiteRef, assetSerialField, assetTypeField, assetWarrantyEndField],
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
CustomObjectPageLayout.basic(workOrderObj, {
|
|
496
|
+
section: workOrderSection,
|
|
497
|
+
fields: [
|
|
498
|
+
'name',
|
|
499
|
+
workOrderSiteRef,
|
|
500
|
+
workOrderAssetRef,
|
|
501
|
+
workOrderPriorityField,
|
|
502
|
+
workOrderStatusField,
|
|
503
|
+
workOrderScheduledStartField,
|
|
504
|
+
workOrderScheduledEndField,
|
|
505
|
+
workOrderSummaryField,
|
|
506
|
+
taskCountOnWorkOrder,
|
|
507
|
+
estimatedHoursOnWorkOrder,
|
|
508
|
+
workOrderLabelField,
|
|
509
|
+
],
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
CustomObjectPageLayout.basic(taskObj, {
|
|
513
|
+
section: taskSection,
|
|
514
|
+
fields: [
|
|
515
|
+
'name',
|
|
516
|
+
taskWorkOrderRef,
|
|
517
|
+
taskTypeField,
|
|
518
|
+
taskStatusField,
|
|
519
|
+
taskEstimatedHoursField,
|
|
520
|
+
taskCompletedAtField,
|
|
521
|
+
partsCountOnTask,
|
|
522
|
+
],
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
CustomObjectPageLayout.basic(partUsageObj, {
|
|
526
|
+
section: partUsageSection,
|
|
527
|
+
fields: ['name', partTaskRef, partSkuField, partQuantityField, partCostCentsField],
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
console.log(manifest.preview());
|