ServiceNow
Using the Advanced Business Rule functionality in ServiceNow, you can automate the creation of ServiceNow activity records in Steady.
Activities in Steady will appear alongside check-ins and in your team's activity stream.
- Navigate to System Definition › Business Rules in your ServiceNow instance.
- Click “New”. Name the Business Rule “SteadyIncident”.
- Select the "Incident[incident]" table.
- Check the Advanced checkbox.
- In When to Run, select "async" from the "When" drop down.
- Check the "Update" checkbox.
- Go to the Advanced tab and paste the following. Make sure to replace the {your team id} and {your API key} sections with your team ID and API key from your team API settings.
(function executeRule(current, previous /*null when async*/) {
try {
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setEndpoint(
"https://service.statushero.com/api/v1/status_activities"
);
restMessage.setRequestHeader(
"X-TEAM-ID",
"{your team id}"
);
restMessage.setRequestHeader(
"X-API-KEY",
"{your api key}"
);
restMessage.setRequestHeader("Content-Type", "application/json");
restMessage.setHttpMethod("post");
var usr = new GlideRecord("sys_user");
usr.get("sys_id", current.getValue("assigned_to"));
var email = usr.getValue("email");
var instanceURL = gs.getProperty("glide.servlet.uri");
var myTable = current.sys_class_name;
var incidentURL =
"<a href=" +
instanceURL +
"incident.do?sys_id=" +
current.sys_id +
">" +
current.getValue("short_description") +
"</a>";
var payload = {
email: email,
source: "ServiceNow",
description: "Updated an incident: " + incidentURL,
};
var body = JSON.stringify(payload);
gs.info("Webhook body: " + body);
restMessage.setRequestBody(body);
var response = restMessage.execute();
var httpStatus = response.getStatusCode();
} catch (error) {
var message = error.message;
gs.error("Error message: " + message);
}
gs.info("Webhook target HTTP status response: " + httpStatus);
})(current, previous);
Troubleshooting
- Look for updates in the activity stream first. The dashboard will sum up updates from the previous period. (The check-ins essentially say "here's what I did yesterday, and here is all of the ServiceNow activity to go along with that.)
- Check to make sure the email address that is being used in ServiceNow matches the email address that is being used in Steady. If you or a team member is using a different email address in ServiceNow, set the secondary email address in Steady o to match the one used in ServiceNow.
- Steady won't be able to record data retroactively. Make sure you generate some activity in ServiceNow in order to test things out after you've set up the connection.