Field Service Management script includes

  • Release version: Australia
  • Updated March 12, 2026
  • 15 minutes to read
  • Script includes used in Field Service Management help configure agent scheduling, dispatch operations, part management, integrations, and more.

    Table 1. Script includes
    Script include Description
    AffectedProductUtil Manages affected product records (wm_m2m_product_to_work_order) on work orders and tasks, providing methods to determine product display names from assets/install base items/CIs, create primary affected products, and update related part requirements and asset usage references.
    AgentScheduleAttributePlanAJAX AJAX processor that retrieves a field service agent's default location from sys_user and calculates the next available rank for agent schedule attribute plans by querying the wm_agent_schedule_attribute_plan table.
    AgentScheduleAttributePlanConstants Customer-extensible constants class that clones AgentScheduleAttributePlanConstantsSNC, providing a customization layer for agent schedule attribute plan constants without modifying the base SNC version.
    AgentScheduleAttributePlanConstantsSNC Defines base constants for the agent schedule attribute plan feature, including the table name (wm_agent_schedule_attribute_plan), default rank values, date range defaults, role references, and field lists used by the scheduling attribute plan framework.
    AgentScheduleAttributePlanQuery Customer-extensible query class for agent schedule attribute plans that inherits from AgentScheduleAttributePlanQuerySNC, providing override hooks for customizing query behavior.
    AgentScheduleAttributePlanQuerySNC Provides query methods for the wm_agent_schedule_attribute_plan table, including fetching records in date ranges, checking for overlapping rank records, retrieving the highest-ranked resource attributes for a given date, and getting agent-specific schedule attribute plans.
    AgentScheduleAttributePlanUtil Customer-extensible utility class for agent schedule attribute plans that inherits from AgentScheduleAttributePlanUtilSNC, serving as the customization layer for agent schedule attribute plan utilities.
    AgentScheduleAttributePlanUtilSNC Provides utility methods to retrieve field service agent work attributes (start/end locations, overtime settings, travel preferences) from wm_agent_schedule_attribute_plan records for specific dates or date ranges, supporting pre-shift and post-shift location lookups.
    AgentWorkConfigUtil Retrieves work parameters (travel radius, overtime, distance unit, and so on) for a list of field service agents on a given date by delegating to AgentScheduleAttributePlanUtil to query the wm_agent_schedule_attribute_plan table.
    AutoRejectWorkOrderTask Automatically rejects (unassigns) a work order task if the assigned agent hasn't accepted it within the configured acceptance duration, logging a rejection record to wm_task_rejection with an 'auto_reject' reason.
    CollisionDetectorDelegate Thin wrapper around ServiceNow's GlideCollisionDetector API that checks whether the collision detector is loaded and whether a specific update name key exists in the collision detector cache.
    DeliveryTypeCheckUtils Determines whether a transfer order line qualifies as a local pickup by checking if the source stockroom type doesn't require shipment, the transfer order isn't a drop-off, and the associated task is a WM task or field stockroom request.
    DynamicSchedulingConfigID AJAX processor that returns the sys_id of the appropriate dynamic scheduling configuration record based on whether the work order (wm_order) configuration is request-driven or not.
    ExecuteAffectedProductRules Evaluates changes to asset and install_base_item fields on work order/task records and triggers the appropriate AffectedProductUtil action (add, update, or remove) to keep the primary affected product in synchronization.
    FlagTaskUtil AJAX utility that enables field service agents to flag and unflag work order tasks by creating or deleting records in the wm_m2m_user_flag_task many-to-many table, and provides methods to check if a task is flagged and retrieves all flagged tasks for the current user.
    FSMAgentInfo Manages field service agent status transitions (on-shift, off-shift, on-break, on-route, on-site) by validating enabled state changes, updating the sys_user agent_status field, storing shift/break history, and recording geolocation history for tracked agents.
    FSMAgentLocationUtil Determines the current estimated location of field service agents by aggregating data from their home location (sys_user), active/completed work order tasks (wm_task), geolocation history, territory planning overrides, and crew locations.
    FSMAjaxUtil Multi-purpose AJAX processor for the FSM dispatcher UI that handles requests such as calculating SLA-based window end times for work order tasks, retrieving task template details, checking plugin activation states (access hours, territory, marketplace), and controlling template read-only behavior based on work order state.
    FSMBellNotifcationUtil Sends in-app bell notifications (ui_notification_inbox) to specified recipients assembled from user fields, group members, and scripted user lists, with a configurable JSON payload targeting a specific task record.
    FSMConditions Evaluates business rule conditions for work order tasks, including whether to validate acceptance duration, raise auto-reject or assigned events, show confirm assignment or auto-assign buttons, and determine if a task should be rescheduled or reassigned based on state changes and configuration settings.
    FSMConstants Defines static constants used throughout the Field Service Management application, including work order table names, task states/substates, agent status values (on-shift, off-shift, on-break, and so on), technician assignment preference types, rejection defaults, and role names.
    FSMDateTimeFormatAjax AJAX processor that formats and converts date/time values for work order tasks, supporting duration-based start/end date calculations and timezone-agnostic conversions based on the task location's timezone.
    FSMDispatcherMapAJAX AJAX processor for the dispatcher map UI that provides methods to retrieve dispatcher groups, agent lists by group, and triggers auto-routing of tasks for a specific agent and date via fsmDispatcherMapUtil.
    fsmDispatcherMapUtil Server-side utility for the dispatcher map that queries dispatch groups and their agent members, triggers auto-routing via SMTaskRouting, and manages dispatcher map filter preferences (wm_dispatcher_map_filter) for assigned/unassigned tasks, dates, and work groups.
    FSMEncodedQueryUtil Parses and manipulates ServiceNow encoded query strings by splitting conditions, inverting/negating operators (for example, swapping = with!=, LIKE with NOT LIKE), and filtering out unsupported condition types such as DATEPART, STARTSWITH, and regex-based operators.
    FSMExtAjaxUtil AJAX processor that checks whether a work order task's assignment group can be changed by verifying if the marketplace plugin is active and the task is a marketplace task, returning a flag indicating whether the assignment group modification is enabled.
    FSMExtPointUtil Loads and retrieves ServiceNow scripted extension point implementations by name using GlideScriptedExtensionPoint, returning the first available extension or the first one whose handles() method returns true.
    FSMGeneralUtil Provides general-purpose utility methods for Field Service Management, including deleting records, controlling WOT related list button visibility, calculating window end times from SLA breach dates, and retrieving transfer order delivery times for work order tasks with mandatory part requirements.
    FSMLocationUtil Calculates geographic distances between latitude/longitude coordinates using the Haversine formula, with support for both miles and kilometers, and provides unit conversion and formatted distance text output.
    FSMManagerMapAJAX AJAX processor for the manager map UI that retrieves manager-specific dispatch groups and agent lists by delegating to fsmManagerMapUtil, providing group and agent data formatted as value/label pairs for the map interface.
    FSMManagerMapHelper Provides helper methods for the FSM Manager Map UI, including retrieving assignment groups and agents for the current manager, and saving/loading map filter preferences (assigned/unassigned tasks, routing numbers, date, work group, agent) to user preference records.
    fsmManagerMapUtil Retrieves assignment groups (filtered by the configured work group type from SMConfigurationHelper) and agents for the logged-in manager, and persists map filter settings to user preferences for the geolocation manager map.
    FSMMapPagesHelper Retrieves a user's geographic coordinates by first checking the most recent geo_history record for the user and falling back to the user's assigned location latitude/longitude.
    FSMMobileUtil Provides mobile-specific utilities for FSM including setting offline device timestamps on task synchronization, finding the best assignment group for an agent based on the work order task's location hierarchy (sys_group_covers_location), and resolving dispatch groups from assignment groups or locations.
    FSMOnsiteAJAXUtil AJAX processor that exposes client-callable methods to check whether the onsite arrival feature is enabled for a task, retrieve geofence radius/unit configuration, and calculate the estimated travel start time by combining travel and onsite buffer durations.
    FSMOnsiteUtil Determines whether the onsite arrival feature is enabled for a given task table via SM configuration, calculates the distance between a task and an agent's coordinates to verify if the agent is within the geofence radius, and sets the check-in status for platform-based geofence validation.
    FSMPartUtil Manages part/inventory requirements for field service tasks, including cloning part requirements to new work order tasks, looking up an agent's personal stockroom, querying required parts across tasks (with bundle support), checking agent inventory against task needs, and creating EAM catalog requests.
    FSMPotentialAssignmentGroupsUtil Manages the list of potential assignment groups for a work order task by synchronizing the wm_work_order_task_potential_assignment_groups table — Adding new groups, replacing stale ones, and inactivating records when a task is canceled or a single match is found.
    FSMQueryFilter AJAX processor that retrieves all agents managed by a given manager by querying groups of type wm_work, checks whether a manager can create records for a specific agent, and returns managed agents considering territory planning if enabled.
    FSMRoutingUtil Calculates driving distance and estimated travel time between agents and tasks for agent recommendation, supporting both map-provider-based (for example, Google Maps) routing and crow-fly distance, with methods for processing suggested agents with or without agent recommendation enabled.
    FSMSchedulingAjax Simple AJAX processor wrapper that exposes the setManualSchedulingMethod function, enabling the client side to set the scheduling method of one or more work order tasks to 'manual' via FSMSchedulingUtil.
    FSMSchedulingAssistantInfoUtil Provides supporting data for the scheduling assistant by evaluating agent part availability (matching task part requirements against agents' personal stockroom inventory) and integrating with WFO scheduling when enabled.
    FSMSchedulingAssistantUtil Powers the scheduling assistant by retrieving available work blocks (time slots) for task assignment, supporting both dynamic scheduling (via DynamicSchedulingProcessor) and non-dynamic modes, and checking for schedule optimization conflicts on locked tasks.
    FSMSchedulingFilters Provides filter queries for the dispatch map and scheduling views, including retrieving tasks flagged for review, tasks assigned to undersized crews, users with active work schedules (supporting both FSM and WFO schedule sources), and users with specific roles.
    FSMSchedulingUtil Provides core scheduling record management utilities: inserting tasks into the review queue, proposed schedule, and scheduling history tables; setting tasks to manual scheduling method; retrieving user timezone information; and checking for schedule overlaps between agents.
    FSMSkillUtil Queries and matches skills for tasks and agents by reading from the task_m2m_skill table (with task bundle support), retrieves an agent's matching skills, and checks whether skills-based configuration is enabled for dispatch.
    FSMStateFlowUtil Determines whether a completed work order task qualifies for the task review flow by running the sn_fsm_quality task review subflow, checks if a task is assigned to an external contractor (wm_ext_agent role), and verifies whether the task review configuration flow is active.
    FSMTaskDependencyConstants Defines static constants for the task dependency feature, including table/column names, dependency types (finish-to-start, start-together), lag time fields, violation types (for example, min lag not elapsed, predecessor not finished), and user-facing conflict/error messages.
    FSMTaskDependencyHelper Evaluates task dependency violations for a successor task by checking predecessor completion status and lag time constraints, determines whether a dependency conflict exists (distinguishing warning vs. info severity), and supports ignoring predecessor dependencies to force-start work.
    FSMTaskDependencyUtil Validates scheduling conflicts for task dependencies by comparing parent/child expected start and estimated end times against min/max lag time constraints for both finish-to-start and start-together dependency types, returning conflicting task numbers.
    FSMTaskMoveUtil Handles task rescheduling and movement on the dispatch calendar by recalculating task end times based on current state (WIP, on-route, closed, scheduled), adjusting expected start times, managing travel/work duration estimates, and handling conflict detection with work spacing.
    FSMTaskQueryHelper Retrieves an agent's (or crew's) assigned task events and personal calendar events for a given date range, supporting bundle tasks, dynamic scheduling, crew member expansion, and WFO schedule integration for the dispatch calendar view.
    FSMTaskSchedulingConflictAPI Customer-extensible wrapper that inherits from FSMTaskSchedulingConflictAPISNC, providing a customization point for overriding scheduling conflict detection behavior without modifying the base implementation.
    FSMTaskSchedulingConflictAPISNC Detects and logs scheduling conflicts for work order tasks by monitoring changes to scheduling-related fields (window, state, location, duration, expected start), evaluating task lock status and optimization job state, and upserting conflict records in the wm_task_scheduling_conflict table.
    FSMTimeCardUtil Manages work order task time tracking including controlling pause/resume UI visibility based on task state and user role, enabling automatic time card creation from metric instances, and calculating actual work duration by summing WIP substate metric durations.
    FSMTimeUtil Provides date/time utilities for task scheduling including timezone conversion, retrieving the user's time format, initializing task scheduling windows (window_start/window_end with fallback defaults), and computing aggregate window ranges across multiple selected tasks.
    FSMTimezoneDisplayUtil Programmatically generates client-side onChange scripts for datetime fields on the wm_task form that display timezone-agnostic information messages, converting date values based on the assigned resource's timezone via FSMDateTimeFormatAjax.
    FSMTimeZoneUtil Resolves timezones for various resource types (agents, crews, equipment) by querying user timezone settings, crew records, and equipment location timezone fields, with fallback to the system default timezone when a resource-specific timezone isn't available.
    FSMURLUtil Constructs portal URLs for FSM by checking for custom URL configurations, and generates survey links for customer/consumer feedback by looking up assessment instances and building shortened portal URLs with the appropriate survey instance ID.
    FSMUtil Central utility library for Field Service Management providing helper methods for user profiles, assignment group lookups (for agents/managers/dispatchers), role checks, Google Maps integration, agent geolocation and distance calculations, task state flow processing, work order/task relationship management, contextual search, and various record-level operations on wm_task and wm_order tables.
    FSMWFOUtil Provides Workforce Optimization (WFO) integration for FSM agent shift scheduling, including methods to check if the FSM WFO plugin is active and enabled via sm_config, create GlideDateTime objects with specific timezones, convert between timezones, and build timemaps from include/exclude spans.
    FSMWMAssignmentGroupUtil Determines whether the current user (as a dispatcher) is the dispatcher for a given agent by checking if the agent's group membership (sys_user_grmember) overlaps with the dispatcher's assigned groups.
    FSMWorkspaceUAUtil Tracks and sends usage analytics events for work order creation within the FSM Agent Workspace, using the ServiceNow Usage Analytics Platform Analytics Framework (sn_uapaf) to stream telemetry data to the 'snc.fsm.workspace' stream.
    GlideMutexAPI Provides a scoped wrapper around GlideMutex for acquiring and releasing named mutex locks with configurable spin count and wait time, used for thread-safe synchronization in server-side scripts.
    IncidentalsUtil Provides a utility method to delete a record from the sm_incidentals table by sys_id, returning true on success or false with a warning if the record isn't found.
    MatchingDimensionRejectedTechnician Filters out recently rejected technicians from auto-assignment candidates by querying the wm_task_rejection table for agents who rejected a given work order task within a configurable time window, and returns the remaining eligible users with default ratings.
    OnsiteGeofenceConfig Returns the default geofence radius configuration (0.5 miles) used for onsite proximity detection in field service tasks.
    OptimalMatchingAlgorithm Implements the Hungarian algorithm (optimal assignment problem solver) to compute lowest-cost pairings between rows and columns in a cost matrix, supporting square and rectangular matrices with padding, used for optimal task-to-agent matching.
    QualifyingAssignmentGroups Filters and identifies qualifying assignment groups for a task based on matching product models handled (via wm_m2m_group_to_model) and required skills (via sys_group_has_skill), supporting both internal (wm_work) and external/vendor (wm_vendor) group types.
    RouteOptimizationTaskLockingAPI Checks the status of active route optimization scheduled jobs by querying FSMSchedulingUtil for job details, and returns active job information used by the task locking framework to prevent modifications during route optimization runs.
    ScheduledStateUtil Manages the 'Scheduled' state in the work order task life cycle by evaluating state flow configurations (sys_process_flow), determining whether the scheduled state is enabled for a task, and controlling whether a task transitions to 'Assigned' based on drip feed mode and time-based scheduling rules.
    SMConfigUtil Provides a cached, performance-optimized wrapper around SMConfigurationHelper for checking feature flags (isEnabled), role-based access (hasRole), dispatch method retrieval, and configuration name uniqueness validation against the sm_config table for wm_task and wm_order.
    TaskWindowModifier Adjusts scheduling time windows for child tasks based on parent task dependency relationships (Finish-to-Start, Start Together, Start After Start), applying minimum and maximum lag times to calculate modified window start and end dates.
    TransferOrderAutoClose Automatically closes delivery and receive tasks for transfer orders associated with a work order task by finding draft transfer order lines where the from and to stockrooms match the agent's field stockroom, receiving the assets, and closing the related line tasks and subtasks.
    WMAgentScheduleReader Reads and provides agent schedule data (both common/shared schedules and personal schedule events) for the dispatch board, querying schedule spans and events for specified agents across weekly time ranges and supporting fallback resource data retrieval.
    WMConfigurationConstants Defines a comprehensive set of static constants used throughout the Work Management application, including table names (wm_task, wm_order, sm_config, etc.), field names, field values, and SM configuration property keys.
    WMFilters Handles auto-population and validation of assignment groups on work order tasks based on location, product model, skills, territory planning, dispatch queue configuration, contractor eligibility, and preferred group routing (internal vs. external), enforcing override rules, and supporting fallback logic.
    WMFiltersBaseImpl Extends SMFilters to provide work management-specific reference qualifier filtering for task templates based on work configuration and task model tables, and determines if a record belongs to wm_order or wm_task table hierarchies.
    WMFlatScheduleEventCommonUtil Provides shared utility methods for the flat schedule event caching system, including week boundary calculations, generating week arrays for date ranges, invalidating flat table records in wm_weekly_resource_span, and managing configuration for past/future week ranges.
    WMFlatScheduleEventUtil Orchestrates the insertion of schedule data into the wm_weekly_resource_span flat table by reading schedules from multiple resource types (agents, crews, equipment) via their respective readers, merging timezone data, and queuing events for weekly updates.
    WMFlatTableInitiallLoadUtil Performs the initial bulk load of agent schedule data into the wm_weekly_resource_span flat table by truncating existing data, querying all active agents in work-type assignment groups (sys_user_grmember), batching them into configurable chunk sizes, and enqueuing them across multiple parallel event queues.
    WMTask Manages work order task (wm_task) life cycle close operations including Close Complete and Close Incomplete with optional follow-on task creation via SMTask.cloneTask, executing the appropriate state flows (including quality review flows when the FSM quality plugin is active).
    WMTemplateImpl Extends SMTemplates to build work order tasks from service order model templates (sm_m2m_somodel_stmodel), applying template-defined fields such as short description, work type, dispatch group, crew requirements, work configuration, location, and access hours to newly created task records.
    WMTemplates Provides template lookup and application logic for work order tasks, including retrieving work order models from catalog items (cmdb_workorder_product_model), building the first work order task from a work order model template, and applying template definition fields (sm_template_definition) to task records.
    WMUtilAjax AJAX processor that retrieves agent assignment and dispatched-on field values for a wm_task record, and determines whether the acceptance due date should be cleared or a warning shown based on scheduled state settings and duration expiration.
    WorkManagementInitiation Creates work orders (wm_order) from various source records (incidents, problems, changes, or other work orders), checking for existing open work orders linked to the source via the initiated_from field to prevent duplicates, and redirecting users to the newly created or existing work order.
    WOT_Radius_Checker AJAX processor that checks whether an agent or crew is within the configured geofence radius of a work order task location by calling FSMUtil.calculateDistance/calculateCrewDistance, and returns the proximity result along with distance details to the client.