How to track incidents created on different portals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 04:07 AM
Hello friends.
I have two different portals and i need to track the incidents created in each one.
The problem is: When an incident is created on any portal the 'Contact type' of the incident is 'Self-Service' and this way i don't know what portal created the Incident.
Thanks in advance!
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 03:15 PM
Is one record producer shared between both portals?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 03:43 PM
Could you set the contact type based on the opened_by? Assuming users use one portal or another.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2018 12:54 PM
Hey guys, I am having a similar issue and was wondering if anybody came up with a solution? I only have 1 portal but still need some way to track how many incidents were created specifically in the portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2018 04:53 PM
you could have an onload client script to parse the url. then based on the url or some parameter in the url you can then set a field on the record you are creating for reporting purposes.
function onLoad() {
//Populate the variables with the parameters passed in the URL
//Use the 'getParmVal' function below to get the parameter values from the URL
var cat = getParmVal('sysparm_category');
var comments = getParmVal('sysparm_comments');
if(cat){
g_form.setValue('my_category_variable',cat);
}
if(comments){
g_form.setValue('my_comments_variable',comments);
}
}
function getParmVal(name){
var url = document.URL.parseQuery();
if(url[name]){
return decodeURI(url[name]);
}
else{
return;
}
}
When working in the Service Portal, ServiceNow severely restricts the objects available for use in client scripts, causing scripts like this to break. Brad Tilton provided this workaround on the ServiceNow community for the ‘getParameterValue’ function that is designed to work around this issue.
function getParameterValue(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(top.location);
if (results == null) {
return "";
} else {
return unescape(results[1]);
}
}
Please note that this code snippet should be used within a client script or catalog client script on a form you’re rendering through the Service Portal. If you’re working within a widget and want to use a url parameter you would want to use angular’s $location service.