5 views

Symptoms


The Search option available under Cloud User Portal is not useful to search specific stack information.

The customer might have multiple stacks available under Manage Stacks section in Cloud User Portal, current search option available is Global, given a stack name to search, the search looks at global available with a specific name but not really serving the need to search only for Stacks or Resources.

Release


Jakarta P*, Kingston P* and London

Environment


Cloud User Portal (CMP) 

Cause


The code currently not supporting the Search option in Cloud User Portal to filter specific information. 

Resolution


While Development is working to update the Search option feasibility for the customer, we can use below workaround which could make the Search option with more relevant information, below is the procedure to modify the search option for stacks.

  1. Log into the instance
  2. Navigate to Service Portal > Search Sources
  3. Filter on the Name field for "Stacks"
  4. Replace the Data fetch script section as below.

 

(function(query) {
var results = [];

if (!gs.isLoggedIn())
return results;

var userRoles = gs.getUser().getUserRoles();
var is_admin = false;
var is_group_admin = false;

if(!gs.nil(userRoles)) {
if(userRoles.indexOf('admin')>-1 || userRoles.indexOf('sn_cmp.cmp_root_admin')>-1)
is_admin = true;
if(userRoles.indexOf('sn_cmp.cloud_group_admin')>-1)
is_group_admin = true;
}

var view = gs.getUser().getPreference('cloud_user_portal_view') || 'mine';

var group_ids = [];

if(is_group_admin || is_admin) {
var grm_rec = new GlideRecord('sys_user_grmember');
grm_rec.addQuery('user',gs.getUserID());
grm_rec.query();
while(grm_rec.next())
group_ids.push(grm_rec.group.sys_id);
}

var sc = new GlideRecord('sn_cmp_stack');

if(view == 'mine')
sc.addEncodedQuery('assigned_to='+gs.getUserID());
else if(view == 'group' && (is_admin || is_group_admin))
sc.addEncodedQuery('assigned_to='+ gs.getUserID()+'^ORowner_groupIN'+ group_ids.join(','));

sc.addQuery("name","STARTSWITH",query);
sc.query();
while (sc.next()) {
if (!$sp.canReadRecord(sc))
continue;

var item = {};
item.name = sc.getDisplayValue("name");
item.sys_id = sc.getUniqueValue();
item.url = "?id=cloud_stack_details&category=cloud_stacks&sys_id=" + sc.getUniqueValue() + "&selected_card="+ sc.getUniqueValue() +"&spa=1&active_tab=changeRequests";
item.primary = item.name;
results.push(item);
}

return results;
})(query);

 

Once above code has been replaced, we could observe the Search in Manage stacks page provide filtered information.  

Additional Information


This is a temporary workaround which could be replaced in future releases.

Article Information

Last Updated:2018-09-07 05:41:07
Published:2018-09-06