{% extends 'admin/master.html' %} {% block body %}

ServiceNow Query

Query the table of a ServiceNow account the same way the import reads it — with the connection, query and field list of the account. The result shows every field a record really has and which name the object would be imported under, so a wrong login, an empty query or the wrong hostname field become visible. Nothing is written: neither ServiceNow nor the syncer's objects are changed here.

{% if not accounts %}
No enabled ServiceNow account found. Create one first.
{% endif %}
One table. The account's own tables are offered here.
In front of /table/<name>.
The field the object name comes from.
Encoded query, e.g. operational_status=1. Empty asks for every record.
Comma separated. Empty asks for every field of the found records.
false shows the sys_ids instead.
Compare reads every record of the table with the query and holds the names against the hosts an export of the syncer would send. Max. results does not apply, a large table takes a while.
{% if error %}
{{ error }}
{% endif %} {% if comparison %}

Used request: {{ comparison.url }}
{% for key, value in comparison.params.items() | sort %} {{ key }}={{ value }}{% if not loop.last %}, {% endif %} {% endfor %}

Comparison with the Syncer
Records read from ServiceNow {{ comparison.records }}
Records without hostname {{ comparison.unnamed }}
Hostnames in ServiceNow {{ comparison.snow_names }}
Hosts in the Syncer {{ comparison.syncer_hosts }}
Found in both {{ comparison.matched }}
Syncer hosts missing in ServiceNow {{ comparison.missing_in_snow | length }}
ServiceNow names without Syncer host {{ comparison.missing_in_syncer | length }}
{% for title, names in [('Syncer hosts missing in ServiceNow', comparison.missing_in_snow), ('ServiceNow names without Syncer host', comparison.missing_in_syncer)] %} {% if names %}
{{ title }} ({{ names | length }})
{% endif %} {% endfor %} {% endif %} {% if result %}

Used request: {{ result.url }}
{% for key, value in result.params.items() | sort %} {{ key }}={{ value }}{% if not loop.last %}, {% endif %} {% endfor %}

{% if result.limits %}

Rate limit of the instance: {% for key, value in result.limits.items() | sort %} {{ key }}: {{ value }}{% if not loop.last %}, {% endif %} {% endfor %}

{% endif %}
{{ result.records | length }} record(s) found {% if result.records | length >= limit %} limit reached {% endif %}
{% if not result.records %}

Nothing found. Empty the query, check the table name, or make sure the account's user may read the table.

{% else %} {% for record in result.records %}
{% if record.hostname %} {{ record.hostname }} would be imported {% else %} no hostname field would be skipped {% endif %} {{ record.labels | length }} field(s)
{% for key, value in record.labels.items() | sort %} {% endfor %}
{{ key }} {%- if value -%}{{ value }} {%- else -%} empty on this record {%- endif -%}
{% endfor %} {% endif %}
{% endif %}
{% endblock %}