Search by REQ# on ServiceNow Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 11:25 AM
Currently, on our Service Portal, we can search by RITM# as shown below
However, when we try to search for the same RITM through its REQ number, it shows nothing:
Is there a script that needs to be added? If yes, what sort of script needs to be added?
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 11:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 11:40 AM
Hey Sanjiv,
I just checked Search Groups in System Definition I do have a request group set to true. It is also called sc_request, just as it shows in your screenshot.
I did open the Portal as you said and it looks like it is in your screenshot. But I do not know what to do with it.
Like the Data Fetch Script is:
(function(query) {
var results = [];
//Here goes the logic. Compute results however you want!
if (!gs.isLoggedIn())
return results;
var sc = new GlideRecord('sc_cat_item');
sc.addQuery('123TEXTQUERY321', query);
sc.addQuery('active',true);
sc.addQuery('no_search', '!=', true);
sc.addQuery('visible_standalone', true);
sc.addQuery('sys_class_name', 'NOT IN', 'sc_cat_item_wizard');
var portalValue = $sp.getValue('sc_catalog');
if (portalValue)
sc.addQuery('sc_catalogs', portalValue);
sc.query();
var catCount = 0;
while (sc.next() && catCount < data.limit) {
if (!$sp.canReadRecord(sc))
continue;
var item = {};
item.type = "sc";
item.page = "sc_cat_item";
if (sc.getRecordClassName() == "sc_cat_item_guide")
item.page = "sc_cat_item_guide";
else if (sc.getRecordClassName() == "sc_cat_item_content") {
var gr = new GlideRecord('sc_cat_item_content');
gr.get(sc.getUniqueValue());
$sp.getRecordValues(item, gr, 'url,content_type,kb_article');
item.type = "sc_content";
}
else
item.type = "sc";
$sp.getRecordDisplayValues(item, sc, 'name,short_description,picture,price,sys_id,sys_class_name');
item.score = parseInt(sc.ir_query_score.getDisplayValue());
item.label = item.name;
item.primary = item.name;
//calculating URL
if (item.type == "sc")
item.url = '?id=' + item.page + '&sys_id=' + item.sys_id;
if (item.type == "sc_content") {
if (item.content_type == "kb")
item.url = '?id=kb_article&sys_id=' + item.kb_article;
else if (item.content_type == "external")
item.target = '_blank';
else
item.url = '?id=sc_cat_item&sys_id=' + item.sys_id;
}
if (item.type == "sc_guide")
item.url = '?id=sc_cat_item_guide&sys_id=' + item.sys_id;
results.push(item);
catCount++;
}
return results;
})(query);
Is there anything specific I need to write?