14 Replies Latest reply on May 12, 2016 9:21 AM by mcf43292

    Customize appearance of Knowledge search results

    dennyjs Apprentice

      Can I customize the appearance of "Knowledge search results" on webdesk/selfservice?

      -  to use the Incident custom number instead of incident ID

      -  to take out the URL

      -  etc.

      Untitled.png

       

      Thanks

        • 1. Re: Customize appearance of Knowledge search results
          CraigMiddelstadt Master

          The search results in webaccess is hard coded.  I had this requirement for a customer and offered the following solution:

          • Created a Knowledge search query and added it to a new dashboard called "Search Knowledge".
          • Applied the following report template:

          <table style="width: 100%">

            <tr>

            <td><font face="Calibri" size="5"><strong>{Title}</strong></font></td>

            </tr>

            <tr>

            <td><font face="Calibri" size="4">{_Description:300}</font></td>

            </tr>

            <tr>

            <td><font face="Calibri" color="#2E5F88" size="2"><u>Click Here To View {Type/Name}</u></font>

            </td>

            </tr>

          </table>

           

          • Result Looks like this:

          search.jpg

           

          When opening the article, each article looks like this:

          Article.jpg

           

          HTML template is applied to an HTML enabled attribute on the article window.

          1 of 1 people found this helpful
          • 2. Re: Customize appearance of Knowledge search results
            dennyjs Apprentice

            Thanks Craig.

             

            The capabilities of knowledge management will not work on this way, such as knowledge domain category and indexing.

            We also can't have single view of knowledge search result which contain article, document and tickets (for analyst).

             

            But anyway thanks a lot for sharing the idea, I will use it since this is the best appearance we can configure for knowledge result in LDSD

            • 3. Re: Customize appearance of Knowledge search results
              Rookie

              Hi Craig,

               

              Thanks for the post.

               

              I have created a template and used the HTML query. The search results are displaying as above. But when opening any search result(article), the window displaying is not in the format you showed. It would be very helpful if you explain the steps or process you followed.

              • 4. Re: Customize appearance of Knowledge search results
                Darren.Bradshaw Specialist

                Could you share how you achieved the results for the HTML enabled attributed, Is it a calculation?  If so would you mind posting it?

                • 5. Re: Customize appearance of Knowledge search results
                  CraigMiddelstadt Master

                  1) Create a String Attribute with -1 length and apply a calculation similar to this set to "After Read"

                   

                  import System

                  static def GetAttributeValue(Article):

                   

                    Value = String.Format("<table style='width: 100%'><tr><td><font face='Calibri' size='6' color='#0D396A'><strong>{0}</strong></font></td></tr><tr><td><font face='Calibri' size='3' color='#7E7E7E'>{1} - Created By: {2}</font></td></tr><tr><td><font face='Calibri' size='5' color='#0D396A'>Details:</font></td></tr><tr><td><font face='Calibri' size='4' color='#000000'>{3}</font></td></tr><tr><td><font face='Calibri' size='5' color='#0D396A'>Solution:</Font></td></tr><tr><td><font face='Calibri' size='4' color='#000000'>{4}</font></td></tr></table>",Article.Title,Article.Type.Name,Article.CreationUser.Title,Article._Description,Article._Solution)

                    return Value

                   

                  2) Then set the "String SubDataType" to HTML.

                  3) Create a new window and only add this string attribute on the window with about 30 lines an no toolbar (Hide the label of the attribute).

                  4) Set up window rules to show this window on update and the create window when creating or modifying the article.  I add an action "Edit Article" with allow association to the window setting to true and a window rule to show the create window for this action so the article can be modified.

                  • 6. Re: Customize appearance of Knowledge search results
                    Darren.Bradshaw Specialist

                    I did something similar:

                     

                    import System
                    static def GetAttributeValue(Article):
                    Value = ''
                    Htmlstart = String.Format("<html><head><title></title><link rel='stylesheet' type='text/css' href='../../content/dcc/css/DCCKnowledgecss.css'></head><body>")
                    Title = String.Format("<table id='table1'><tr class='head'><td>{0}</td></tr>", Article.Title)
                    DescriptionTitle = String.Format("<tr><td>Description</td></tr>")
                    Description = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._Description)
                    SolTitle = String.Format("<tr><td>Solution</td></tr>")
                    Solution = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._Solution)
                    KeyTitle = String.Format("<tr><td>Keywords</td></tr>")
                    Keywords = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._KeywordsTags)
                    Htmlend = String.Format("</table></body></html>")
                    Video = ''
                    VideoHead = ''

                    if Article.Status != null and Article.Status.Title == 'Approved':
                      status = Article.Status.Title
                    if Article._Video != null and Article._Video == true:
                      VideoHead = String.Format("<tr><td>Video</td></tr>")
                      Video = String.Format("<video width='400' controls><source src='../../content/dcc/videos/{0}.mp4' type='video/mp4'>Your browser does not support HTML5 video.</video>",Article.Title)

                    Value = Htmlstart
                    Value += Title
                    Value += DescriptionTitle
                    Value += Description
                    Value += SolTitle
                    Value += Solution
                    Value += KeyTitle
                    Value += Keywords
                    Value += VideoHead
                    Value += Htmlend
                    Value += Video

                    return Value

                     

                    And here is a sample of the output

                    • 7. Re: Customize appearance of Knowledge search results
                      Rookie

                      Craig,

                       

                      I used your calculation and it was just what I was looking for end user.  However, our articles are doing this weird thing where the group box is pushed down, instead of being aligned at the top.

                      I'm not sure if this issue is related to the calculation, but I haven't had this issue with any other window.

                       

                      I'm wondering it it's related to the Actions window, because when I toggle it to hide, the Article goes back to the top.

                      Has anyone else encountered this issue?

                       

                      Alternatively, if anyone knows of a way to hide the Actions window and possibly the Save and Close, Save and Cancel button, that would be even better.

                      • 8. Re: Customize appearance of Knowledge search results
                        Rookie

                        Hi Darren, what am I missing???  --Thanks!!

                         

                        -Test(20,9): BCE0043: Unexpected token: Htmlstart.

                        -Test(21,2): BCE0043: Unexpected token: Value.

                        -Test(30.16): BCE0044: expecting "EOF", found '<DEDENT>'.

                        =============

                        Import System

                        Static def GetAttributeValue(Article):

                        Value = ''

                        Htmlstart = String.Format("<html><head><title></title><link rel='stylesheet' type='text/css' href='../../ServiceDesk.Resources/knowledge.css'></head><body>")

                        Title = String.Format("<table id='table1'><tr class='head'><td>{0}</td></tr>", Article.Title)

                        DescriptionTitle = String.Format("<tr><td>Description</td></tr>")

                        Description = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._Description)

                        SolTitle = String.Format("<tr><td>Solution</td></tr>")

                        Solution = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._Solution)

                        KeyTitle = String.Format("<tr><td>Keywords</td></tr>")

                        Keywords = String.Format("<tr class='detail'><td>{0}</td></tr>", Article._KeywordsTags)

                        Htmlend = String.Format("</table></body></html>")

                        Video = ''

                        VideoHead = ''

                        if Article.Status != null and Article.Status.Title == 'Approved':

                          status = Article.Status.Title

                        if Article._Video != null and Article._Video == true:

                          VideoHead = String.Format("<tr><td>Video</td></tr>")

                          Video = String.Format("<video width='400' controls><source src='../../ServiceDesk.Resources/Videos/{0}.mp4' type='video/mp4'>Your browser does not support HTML5 video.</video>",Article.Title)

                        Value = Htmlstart

                        Value += Title

                        Value += DescriptionTitle

                        Value += Description

                        Value += SolTitle

                        Value += Solution

                        Value += KeyTitle

                        Value += Keywords

                        Value += VideoHead

                        Value += Htmlend

                        Value += Video

                        return Value

                        • 9. Re: Customize appearance of Knowledge search results
                          Darren.Bradshaw Specialist

                          Can't tell from your post, but it may be the indenting.  I have attached a text file with my calculation.

                          • 10. Re: Customize appearance of Knowledge search results
                            Rookie

                            Validated that time!! Thank you, Darren!  Cheers!

                            • 11. Re: Customize appearance of Knowledge search results
                              nlester77 Employee

                              Hi Craig

                               

                              I was intrigued, on how you created your 'Knowledge search query'?

                               

                              I'd like to implement a similar thing.

                               

                              Thanks

                               

                              Noel

                              • 12. Re: Customize appearance of Knowledge search results
                                CraigMiddelstadt Master

                                Create the knowledge query with the criteria that is appropriate.  Through an after save calculation I added all the details of the article to the Knowledge Search -1 string attribute and you set this up to search using contains.

                                Then add the query to webaccess and apply the report template I listed.

                                • 13. Re: Customize appearance of Knowledge search results
                                  mburton147 Apprentice

                                  Does anyone know how to add the interactive effectiveness buttons so end users can rate the article (the Yes/No buttons)

                                  • 14. Re: Customize appearance of Knowledge search results
                                    mcf43292 Apprentice

                                    did this last year although the effectiveness scoring as a button is added onto the Window of your knowledge article.

                                     

                                    Its covered in the knowledge management document for your environment.

                                     

                                    You set the scoring points from Knowledge Settings within Console, add the button for effectiveness scoring, rebuild your knowledge index and it should work appropriately.

                                     

                                    Thanks

                                    Stephen