Create a REST Message and Business Rule in ServiceNow to automatically trigger work order creation in Field Nation.
Two components in ServiceNow that work together:
wm_task table and fires the REST Message when a task reaches Pending DispatchYou need the Trigger URL from the Configuration page before starting. If you haven't completed configuration, do that first.
This defines the HTTP request ServiceNow will send to Field Nation.
Go to System Web Services → Outbound → REST Message and click New.
Name: Field Nation Webhook
Endpoint: Paste only the base URL of your Trigger URL — everything before the ?. For example:
https://micro.fieldnation.com/v1/broker/inboundCopy the base URL from your Trigger URL in the Integration Broker. Do not type it manually — the path differs between production and sandbox environments.
Right-click the top header and click Save.
Scroll down to the HTTP Methods tab and click Default POST.
Scroll to the HTTP Query Parameters section. Add two rows:
| Name | Value |
|---|---|
client_token | (Paste your token from Field Nation) |
external_id | ${sys_id} |
Do not hardcode client_token into the Endpoint URL field. ServiceNow may
strip query strings pasted directly into URL fields. Add it as a query
parameter instead.
Use the exact variable format ${sys_id} for external_id. ServiceNow
dynamically injects the triggering record's unique ID at runtime.
The external_id query parameter name and client_token are defined by the
Integration Broker's inbound endpoint. The Integration Broker UI may display a
note saying "We will look in the POST body for the id" — the broker accepts
both approaches. Using external_id as a query parameter (as shown above) is
the recommended method for ServiceNow Business Rule triggers.
Scroll to the HTTP Headers section and add:
| Name | Value |
|---|---|
Content-Type | application/json |
Click the HTTP Request tab. In the Content box, paste:
{ "sys_id": "${sys_id}", "table": "${table}", "timestamp": "${timestamp}" }Click Update to save the HTTP method.
Before creating the Business Rule, verify the REST Message works:
In the HTTP Methods tab, click Default POST.
In the Variable Substitutions section, enter:
| Variable | Test Value |
|---|---|
sys_id | test_12345 |
table | wm_task |
timestamp | 1714300000000 |
Scroll to the bottom and click Test.
Success: HTTP 200 response. The trigger was received by Field Nation (no work order is created from a test sys_id).
Failure: Check the endpoint URL and client_token value.
This script monitors the wm_task table and triggers the REST Message when your conditions are met.
Go to System Definition → Business Rules and click New.
| Field | Value |
|---|---|
| Name | Push to Field Nation |
| Table | wm_task |
| Active | Checked |
| Advanced | Checked (reveals the script editor) |
Click the When to run tab:
| Setting | Value |
|---|---|
| When | after |
| Insert | Checked |
| Update | Checked |
Configure the condition using three dropdowns:
| Dropdown | Value |
|---|---|
| Field | State |
| Operator | changes to |
| Value | Pending Dispatch |
Use changes to, not is. The changes to operator fires only on the
state transition. Using is causes duplicate API calls every time the record
is saved while already in that state.
Click the Advanced tab. Paste the following into the Script field:
(function executeRule(current, previous /*null when async*/) {
try {
var r = new sn_ws.RESTMessageV2("Field Nation Webhook", "Default POST");
r.setStringParameterNoEscape("sys_id", current.sys_id.toString());
r.setStringParameterNoEscape("table", current.getTableName());
r.setStringParameterNoEscape(
"timestamp",
new GlideDateTime().getNumericValue(),
);
r.executeAsync();
gs.info(
"Field Nation Trigger queued for " +
current.getTableName() +
":" +
current.sys_id,
);
} catch (ex) {
gs.error("Field Nation Trigger Error: " + ex.message);
}
})(current, previous);Click Submit.
With the REST Message and Business Rule in place, trigger the integration by creating a task that meets your filter conditions.
In the left navigation bar, go to Work Order → Tasks (or type wm_task.list in the filter navigator and press Enter).
Click New and fill in the required fields:
If you configured Template Bypass, populate the same fields that exist on your template record.
Change the State dropdown to Pending Dispatch.
Right-click the top header and click Save (or click Update). The Business Rule fires, the REST Message sends the sys_id to Field Nation, and a work order is created.
Last updated on