Home Service Manager Portal Feature Requests
We appreciate you taking the time to vote and add your suggestions to make our products awesome! Your request will be submitted to the community for review and inclusion into the backlog.

We recommend reviewing what is submitted before posting, in case your idea has already been submitted by another community member. If it has been submitted, vote for that existing feature request (by clicking the up arrow) to increase its opportunity of being added to Cireson solutions.

For more information around feature requests in the Cireson Community click here.

Filter service offerings on name

Is it possible to use both the Home and Alernate home to filter specific service and request offerings on these pages on a specific name?
Like showing all the offerings starting with 'IN:*' in their name or description on one page, and the other one with all the ones starting with 'SR:*'
Can this be done with modifying the css / js?

Best Answer

Answers

  • Dieter_SaerensDieter_Saerens Partner IT Monkey ✭
    This is possible via JS for the alternate homepage but not for the OOB homepage.  However, you could make the filter dynamic by passing in a param via the URL. The ROs on the alternate homepage are wrapped in div's that have a data-title and a data-desc attribute with corresponding string values. So you could use a jQuery selector like this to find them:
    
    $( "div[data-title*='IN:'], div[data-desc*='IN:']" )
    

    Now add a function like this to get params from the url:

    
    function getUrlVars(){
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for(var i = 0; i < hashes.length; i++)
        {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }

    And to make the jQuery selector dynamic:
    
    $( "div[data-title*='"+getUrlVars()['filter']+"'], div[data-desc*='"+getUrlVars()['filter']+"']" )
    

    Now add ?filter=IN to the end of any links to the homepage that you want to be filtered.

    *not fully tested but should get you to where you need to be.
    Thanks for this info James,
    Do I place all this code in the custom.js?
    So far it doesn't seems to work while using the filter nor use the hardcoded one.
  • james_kleinschnitzjames_kleinschnitz Cireson Dev, Product Owner Advanced IT Monkey ✭✭✭
    @Dieter_Saerens these are just the basic building blocks, you will still need to add the basic workflow and application logic.  Without knowing exactly what you are trying to do, and the setup of our service catalog it will be hard to create a full proof solution.  
    But basically yes you want to add code in your custom.js file that waits for your page to be loaded and then applies the filter by selecting the objects and doing something with them. Let's say you want your filter to be a hide filter or elements to filter out.  You could do something like this once the page is loaded:

    $( "div[data-title*='"+getUrlVars()['filter']+"'], div[data-desc*='"+getUrlVars()['filter']+"']" ).hide();
    This will hide everything that matches the filter.
  • Dieter_SaerensDieter_Saerens Partner IT Monkey ✭
    @Dieter_Saerens these are just the basic building blocks, you will still need to add the basic workflow and application logic.  Without knowing exactly what you are trying to do, and the setup of our service catalog it will be hard to create a full proof solution.  
    But basically yes you want to add code in your custom.js file that waits for your page to be loaded and then applies the filter by selecting the objects and doing something with them. Let's say you want your filter to be a hide filter or elements to filter out.  You could do something like this once the page is loaded:

    $( "div[data-title*='"+getUrlVars()['filter']+"'], div[data-desc*='"+getUrlVars()['filter']+"']" ).hide();
    This will hide everything that matches the filter.

    Thanks for the update. In this case we want to show only the offerings (both request and service) that contains the filter in the title or description.
  • Dieter_SaerensDieter_Saerens Partner IT Monkey ✭
    As I am a total JS noob and only script with Powershell, all the help regarding this is welcome.

    A full overview of what we are looking for:

    Have a way to load the alternate homepage and only show the offerings (both requests and services) that contains the filter, hiding everything that is not equal to the filter.
     I tried adding the last line of code, but it doesn't hide anything (should hide all except the match with the filter tho)
Sign In or Register to comment.