Home Analyst Portal

Edit default work item search to search by ID

Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭
Hi guys,
today we've sucessfully released a new version of our Cireson portal in our company and one of the most vocal requests from our analysts was if we could search work items defaultly by ID, as default is set to "actual cost". Our analysts were using SCSM console for years now so they are used to searching by ID, so if anyone could help us out here a bit, we'd be grateful :smile:  Thanks!


Answers

  • Nick_FlintNick_Flint Customer Advanced IT Monkey ✭✭✭
    The search bar at the top of the portal is the fastest way to search for a specific work it when you have the ID: 

  • Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭
    I know that , but during our redesign of the portal we decided to get rid of the upper search bar so I'm trying to find a "replacement" for it :) 
  • Shane_WhiteShane_White Cireson Support Super IT Monkey ✭✭✭✭✭
    If you are looking for an alternative does this mean you currently are going on the left hand Panel for Searches > Work item search?

    If so, why don't you make yourself a saved search with the fields you want for default as listed above. Then save this Saved Search, go into Navigation Settings, you will see it under Search > My Searches, then move your Saved Search from 'My Searches' to 'Searches'

    This will then make it visible for everyone and you can name it something like 'Default Workitem Search'

    Let me know if this works!

    Thanks,
    Shane.
  • Gabriel_LencesGabriel_Lences Customer Advanced IT Monkey ✭✭✭
    Not sure if I completely understand. If i get the criteria in for the "search by ID" and save the search it will return no results as i didn't put any data in , only the criteria. Therefore everyone needs to click "edit" everytime afterwards, if he/she wants to a search.  I was just looking if there's a way through some javascript or something to change the default field that's "actual cost", to "ID" nothing more :smile:
  • Shane_WhiteShane_White Cireson Support Super IT Monkey ✭✭✭✭✭
    Oh yh of course, I forgot about that I know people have done custom search pages before which they were able to set defaults for but I personally do not know where this could be changed for that search. Hope someone else does!

  • Nick_FlintNick_Flint Customer Advanced IT Monkey ✭✭✭
    The problem I run into using JS to change the field value is that it doesn't trigger the field change event. You can; however, use JS to display the Edit section of a custom search.

    You can essentially achieve the same thing you're asking for by creating the custom search as @Shane_White suggested and updating the Navigation link to go to your custom search instead of the default search. Then add the following to your custom.js:
    //Change the id after /View/ to match the id of your custom Search
    if(url.indexOf("/View/c693fe24-e255-4144-9941-7928fb6031a2") > -1){
    	$(document).ready(function() {
    	
    	//The navigation node doesn't load immediately. Get the main div that definitely exists.
    	var mainPageNode = document.getElementById('main_wrapper');
    
    	// create an observer instance to display the results section once a search is run
    	var observer = new MutationObserver(function(mutations) {
    
    		//The page changed. See if our element exists yet.
    		if($('div[data-bind^="slide: editMode"]').length > 0){
    						
    			//This makes the edit part of the search show up
    			$('div[data-bind^="slide: editMode"]')[0].style.display="";
    		}
    	});
    	
    	// configure the observer and start the instance.
    	var observerConfig = { attributes: true, childList: true, subtree: true, characterData: true };
    	observer.observe(mainPageNode, observerConfig);
    });
    }
    
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    This gets more advanced than most folks are probably comfortable with, but it is an option that some may be interested in:

    You can make a copy of the Scripts\viewPanels\queryBuilder\controller.js in your CustomSpace folder and have IIS redirect to your copy.  Then, you can edit your custom controller file to either exclude fields you do not want in the list, or to sort them differently.

    The approaches @Nick_Flint and @Shane_White suggest may be better in most situations, but although this one is more complex (i.e. you have to make sure to keep your file up to date as new portal versions come out), it is a more direct way of solving the issue.
Sign In or Register to comment.