Document toolboxDocument toolbox

Service Now Integration - Incident

Service Now Integration is built upon PCR-360's Custom API Endpoints. Service Now will send its requests to the appropriate Endpoint and PCR-360 will process the details accordingly.

SNOW: Incident
<?php
// Creates an incident with ServiceNow data in the ServiceNow Details UD table
// log the original request JSON in the SERVICENOW_DETAILS UDF table
$details = ["data" => []];
$systemValues = [
    "apikey" => "apikey",
    "typeformat" => "typeformat",
    "module" => "module",
    "controller" => "controller",
    "action" => "action",
    "request_method" => "request_method",
    "limit" => "limit",
    "page" => "page",
    "tenants_recid" => "tenants_recid",
    "ident" => "ident"
];
$data = array_diff_key($request, $systemValues);
foreach ($data as $field => $value) {
    $details["data"][] = [
        "LABEL" => $field,
        "VALUE" => $value
    ];
}
// set the save data
$payload = [
    "type" => "IN",
    "csr" => "1", // User PCR Demo
    "udf_SERVICENOW_NUMBER" => trim($request["servicenow_number"]), // SERVICENOW_NUMBER
    "udf_SERVICENOW_DETAILS" => json_encode($details), // SERVICENOW_DETAILS
];

$result = $this->call("saveServiceDesk", $payload);
$response = ["servicedesk_number" => $result["data"]];

Help Desk Portal - Email: help@pcr.com - Phone: 616.259.9242