ServiceNow Issue Reporting Topic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2023 09:42 AM - edited 06-24-2023 02:34 PM
Hello all,
I am currently working on a 'Report ServiceNow Problem' Virtual Agent topic and wondering if anyone has done this or if I am forgetting something important. Right now, the two variables I have setup up is to pull the node information and the browser type. I think that is all I can pull directly from the system without user responses but want to confirm.
I am using this to pull the node information:
(function execute() {
var interactionsysid = vaVars._interaction_record_sysid;
var getConvo = new GlideRecord('interaction');
getConvo.addQuery('sys_id', '=', interactionsysid);
getConvo.query();
if (getConvo.next()) {
var conversation_record_sysid = getConvo.channel_metadata_document.sys_id;
var node = systemid.system_id;
var systemid = new GlideRecord('sys_cs_message');
systemid.addQuery('conversation', conversation_record_sysid);
systemid.query();
if (systemid.next()) {
return systemid.system_id;
} else {
return false;
}
}
})()
And using this to pull the browser info:
(function execute() {
var interactionsysid = gs.getSession().getSessionID();
var getConvo = new GlideRecord('syslog_transaction');
getConvo.addQuery('session', '=', interactionsysid);
getConvo.query();
if (getConvo.next()) {
return getConvo.user_agent;
} else {
return false;
}
})()
- Labels:
-
VA
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2023 11:56 AM
Update: I went ahead an added device type as I foresee that being useful.
(function execute() {
var interactionsysid = vaVars._interaction_record_sysid;
var getConvo = new GlideRecord('interaction');
getConvo.addQuery('sys_id', '=', interactionsysid);
getConvo.query();
if (getConvo.next()) {
var conversation_record_sysid = getConvo.channel_metadata_document.sys_id;
var node = deviceType.device_type;
var deviceType = new GlideRecord('sys_cs_conversation');
deviceType.addQuery('title.sys_id', conversation_record_sysid);
deviceType.query();
if (deviceType.next()) {
return deviceType.device_type;
} else {
return deviceType.device_type;
}
}
})()
As to the information gathering, I am using issue-troubleshooting.pdf (servicenow.com) for the questions. Which get passed over to the incident:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 10:35 PM - edited 06-28-2023 10:49 PM
*bump as this should be an OOB topic imo. I also includedthe following within the topic:
Gather slow jobs:
(function execute() {
//https://developer.servicenow.com/dev.do#!/learn/courses/sandiego/app_store_learnv2_virtualagent_sandiego_virtual_agent/app_store_learnv2_virtualagent_sandiego_developing_virtual_agent_topics/app_store_learnv2_virtualagent_sandiego_scripting_virtual_agent
// Initialize an array for the options
var options = [];
// Query the table selected in the Choice List Setting
var grUser = new GlideRecord('syslog_transaction');
//grUser.addQuery('name','CONTAINS','lincoln');
grUser.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^urlSTARTSWITHJOB:^response_time>=1000000');
grUser.orderBy('response_time');
grUser.orderBy('sys_created');
grUser.setLimit(20);
grUser.query();
// Push a value/label pair into the array for each record found by the query
// Always use getUniqueValue() for the value
// Concatenate field values for the label
while(grUser.next()) {
var string = grUser.system_id.toString();
var n = string.split(":");
n[1];
options.push({ 'value': grUser.getUniqueValue(''),
'label': grUser.getDisplayValue('response_time') + ", " + grUser.getValue('url') + " - " +
'node id: '+ n[1] });
}
// convert system_id to node only
// Return the array
return options;
vaVars.slow_jobs = options; //created script variable
})()
And pull stats.do
(function execute() {
var array = [];
var diag = new Diagnostics();
while (diag.nextNode()) {
var diagNode = diag.getNode();
var nodeName = diagNode.name.toString();
var n = nodeName.split(":");
var gr = new GlideRecord('sys_cluster_state');
gr.addQuery('system_id', 'CONTAINS', n[1]);
gr.query();
while (gr.next()) {
var nodeType = gr.node_type.name;
var memUse = diagNode.stats['system.memory.in.use'];
var memFree = diagNode.stats['system.memory.pct.free'];
array.push("Node name: " + n[1] + " Node Type: " + nodeType + " Memory in use: " + memUse + " Memory % Free: " + memFree);
}
}
return array;
vaVars.stats_do = array; //created script variable
})()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 10:39 PM - edited 06-28-2023 10:54 PM
@Victor Chen ⬆️ I am sure there is a better way for this and why I am tagging you