/servicenow:field-servicefrom ServiceNow
Develops ServiceNow Field Service Management — wm_order work orders, wm_task tasks, wm_resource technicians, dispatch/auto-assignment, and time entries. Provides ES5 GlideRecord examples.
Ships in ServiceNow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Field Service Management (FSM) manages work orders, technician dispatch, and mobile field operations.
Work Order (wm_order)
├── Work Order Tasks (wm_task)
│ ├── Time Entries
│ └── Parts Used
├── Asset/CI
└── Location
Dispatch
├── Scheduling
└── Route Optimization
| Table | Purpose |
|---|---|
wm_order | Work orders |
wm_task | Work order tasks |
wm_resource | Field technicians |
wm_schedule_entry | Schedule entries |
wm_territory | Service territories |
// Create work order (ES5 ONLY!)
var workOrder = new GlideRecord("wm_order")
workOrder.initialize()
// Basic info
workOrder.setValue("short_description", "HVAC repair - Building A")
workOrder.setValue("description", "AC unit not cooling properly")
workOrder.setValue("priority", 2)
// Classification
workOrder.setValue("work_order_type", "repair")
workOrder.setValue("category", "hvac")
// Location
workOrder.setValue("location", locationSysId)
workOrder.setValue("cmdb_ci", hvacUnitCISysId)
// Customer/Contact
workOrder.setValue("account", customerAccountSysId)
workOrder.setValue("contact", contactSysId)
// Scheduling
var scheduledStart = new GlideDateTime()
scheduledStart.addDaysLocalTime(1)
workOrder.setValue("scheduled_start", scheduledStart)
// Assignment
workOrder.setValue("assignment_group", fieldServiceGroupSysId)
// SLA
workOrder.setValue("sla", slaDefinitionSysId)
workOrder.insert()
// Create work order tasks (ES5 ONLY!)
function createWorkOrderTasks(workOrderSysId, tasks) {
var createdTasks = []
for (var i = 0; i < tasks.length; i++) {
var task = new GlideRecord("wm_task")
task.initialize()
task.setValue("work_order", workOrderSysId)
task.setValue("short_description", tasks[i].description)
task.setValue("order", (i + 1) * 100)
// Estimated duration
task.setValue("estimated_duration", tasks[i].duration)
// Skills required
if (tasks[i].skills) {
task.setValue("skills", tasks[i].skills)
}
// Parts needed
if (tasks[i].parts) {
task.setValue("u_parts_required", tasks[i].parts)
}
var taskSysId = task.insert()
createdTasks.push({
sys_id: taskSysId,
number: task.getValue("number"),
})
}
return createdTasks
}
// Example
createWorkOrderTasks(workOrderSysId, [
{ description: "Diagnose AC unit", duration: "01:00:00", skills: "hvac_certified" },
{ description: "Replace compressor", duration: "02:00:00", parts: "COMP-AC-001" },
{ description: "Test and verify", duration: "00:30:00" },
])
// Create field technician profile (ES5 ONLY!)
var resource = new GlideRecord("wm_resource")
resource.initialize()
// Link to user
resource.setValue("user", userSysId)
// Skills
resource.setValue("skills", "hvac_certified,electrical,plumbing")
// Territory
resource.setValue("territory", territorySysId)
// Availability
resource.setValue("work_schedule", scheduleId)
// Vehicle/Equipment
resource.setValue("vehicle", vehicleCISysId)
// Active
resource.setValue("active", true)
resource.insert()
// Get available technicians for time slot (ES5 ONLY!)
function getAvailableTechnicians(scheduledStart, scheduledEnd, requiredSkills, territory) {
var available = []
// Get all active technicians in territory
var resource = new GlideRecord("wm_resource")
resource.addQuery("active", true)
if (territory) {
resource.addQuery("territory", territory)
}
resource.query()
while (resource.next()) {
// Check skills
if (requiredSkills && !hasRequiredSkills(resource, requiredSkills)) {
continue
}
// Check availability
if (!isAvailable(resource, scheduledStart, scheduledEnd)) {
continue
}
var user = resource.user.getRefRecord()
available.push({
resource_sys_id: resource.getUniqueValue(),
user_sys_id: user.getUniqueValue(),
name: user.getDisplayValue(),
skills: resource.getValue("skills"),
territory: resource.territory.getDisplayValue(),
})
}
return available
}
function hasRequiredSkills(resource, requiredSkills) {
var techSkills = resource.getValue("skills").split(",")
var required = requiredSkills.split(",")
for (var i = 0; i < required.length; i++) {
if (techSkills.indexOf(required[i].trim()) === -1) {
return false
}
}
return true
}
function isAvailable(resource, start, end) {
// Check for conflicting assignments
var assignment = new GlideRecord("wm_schedule_entry")
assignment.addQuery("resource", resource.getUniqueValue())
assignment.addQuery("start", "<", end)
assignment.addQuery("end", ">", start)
assignment.query()
return !assignment.hasNext()
}
// Dispatch work order to technician (ES5 ONLY!)
function dispatchWorkOrder(workOrderSysId, resourceSysId, scheduledStart, scheduledEnd) {
// Create schedule entry
var schedule = new GlideRecord("wm_schedule_entry")
schedule.initialize()
schedule.setValue("work_order", workOrderSysId)
schedule.setValue("resource", resourceSysId)
schedule.setValue("start", scheduledStart)
schedule.setValue("end", scheduledEnd)
schedule.setValue("state", "scheduled")
schedule.insert()
// Update work order
var wo = new GlideRecord("wm_order")
if (wo.get(workOrderSysId)) {
wo.setValue("assigned_to", getResourceUser(resourceSysId))
wo.setValue("scheduled_start", scheduledStart)
wo.setValue("scheduled_end", scheduledEnd)
wo.setValue("state", "assigned")
wo.update()
}
// Notify technician
gs.eventQueue("wm.work_order.assigned", wo, resourceSysId, "")
return schedule.getUniqueValue()
}
// Auto-dispatch to best available technician (ES5 ONLY!)
function autoDispatch(workOrderSysId) {
var wo = new GlideRecord("wm_order")
if (!wo.get(workOrderSysId)) {
return { success: false, message: "Work order not found" }
}
// Get requirements
var scheduledStart = new GlideDateTime(wo.getValue("scheduled_start"))
var estimatedDuration = wo.getValue("estimated_duration") || "02:00:00"
var scheduledEnd = new GlideDateTime(scheduledStart)
var durationParts = estimatedDuration.split(":")
scheduledEnd.addSeconds(
parseInt(durationParts[0], 10) * 3600 + parseInt(durationParts[1], 10) * 60 + parseInt(durationParts[2], 10),
)
var requiredSkills = wo.getValue("u_required_skills")
var location = wo.location.getRefRecord()
var territory = location.getValue("u_territory")
// Find available technicians
var available = getAvailableTechnicians(scheduledStart, scheduledEnd, requiredSkills, territory)
if (available.length === 0) {
return { success: false, message: "No available technicians" }
}
// Select best match (first available, could add routing optimization)
var bestMatch = available[0]
// Dispatch
var scheduleId = dispatchWorkOrder(workOrderSysId, bestMatch.resource_sys_id, scheduledStart, scheduledEnd)
return {
success: true,
technician: bestMatch.name,
schedule_id: scheduleId,
}
}
// Update from mobile app (ES5 ONLY!)
function updateWorkOrderFromMobile(workOrderSysId, statusUpdate) {
var wo = new GlideRecord("wm_order")
if (!wo.get(workOrderSysId)) {
return { success: false, message: "Work order not found" }
}
// Update state
if (statusUpdate.state) {
wo.setValue("state", statusUpdate.state)
if (statusUpdate.state === "work_in_progress") {
wo.setValue("actual_start", new GlideDateTime())
} else if (statusUpdate.state === "closed_complete") {
wo.setValue("actual_end", new GlideDateTime())
}
}
// Add work notes
if (statusUpdate.notes) {
wo.work_notes = statusUpdate.notes
}
// Update location (GPS)
if (statusUpdate.latitude && statusUpdate.longitude) {
wo.setValue("u_technician_latitude", statusUpdate.latitude)
wo.setValue("u_technician_longitude", statusUpdate.longitude)
}
wo.update()
return { success: true }
}
// Record technician time (ES5 ONLY!)
function recordTimeEntry(workOrderSysId, timeData) {
var entry = new GlideRecord("time_card")
entry.initialize()
entry.setValue("task", workOrderSysId)
entry.setValue("user", gs.getUserID())
entry.setValue("type", timeData.type) // work, travel, break
entry.setValue("start_time", timeData.startTime)
entry.setValue("end_time", timeData.endTime)
// Calculate duration
var start = new GlideDateTime(timeData.startTime)
var end = new GlideDateTime(timeData.endTime)
var duration = GlideDateTime.subtract(start, end)
entry.setValue("duration", duration)
// Notes
entry.setValue("comments", timeData.notes)
return entry.insert()
}
| Tool | Purpose |
|---|---|
snow_query_table | Query FSM tables |
snow_execute_script | Test FSM scripts |
snow_artifact_manage | Find configurations (action='find') |
// 1. Query open work orders
await snow_query_table({
table: "wm_order",
query: "state!=closed_complete^state!=cancelled",
fields: "number,short_description,location,scheduled_start,assigned_to",
})
// 2. Find available technicians
await snow_execute_script({
script: `
var available = getAvailableTechnicians(
new GlideDateTime(),
new GlideDateTime().addHours(2),
'hvac_certified',
null
);
gs.info(JSON.stringify(available));
`,
})
// 3. Get technician schedule
await snow_query_table({
table: "wm_schedule_entry",
query: "resource.user=technician_user_id^startONToday",
fields: "work_order,start,end,state",
})
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub serac-labs/serac --plugin servicenow70 skills in this plugin
/acl-securityCreate and debug ServiceNow ACLs (record, field, REST, script-include). Covers role/condition/script patterns, which ACL names can apply to a table or field, field-level visibility, and impersonation testing for row- and field-level security./agent-workspaceBuild ServiceNow Agent Workspace configurations — workspaces, lists, forms, contextual side panels, Agent Assist similar-record finders, and workspace-specific UI actions on sys_aw_* tables./agile-developmentServiceNow Agile Development 2.0 — the rm_team → rm_sprint → rm_story → rm_epic model, the state and point values ServiceNow actually accepts, how a story is attached to a sprint, and the reporting tools (board, burndown, velocity, capacity, standup, retrospective)./approval-workflowsConfigure ServiceNow approval rules and sysapproval_approver records — manager/group/script approvers, multi-level routing, delegation via sys_user_delegate, and parent-record state rollup./asset-managementManage ServiceNow hardware assets, software licenses, and lifecycle states on alm_hardware/alm_license — license allocation, CMDB-to-asset linking, warranty tracking, inventory aggregation (HAM/SAM)./atf-testingBuild ServiceNow Automated Test Framework tests and suites — impersonation, form steps, assertions, server-side script steps, test parameters, and execution via snow_create_atf_test / snow_execute_atf_test.Other plugins' skills for the same job