Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Adjust "Search page template" from Search Source for personalized view

Simon Ohle
Kilo Guru

Hello,

I try to add a custom Search Source, but I can't get the search results look like I want them to.
I want to add more or other informations to the search results in the faceted search.

 

These are my settings:

find_real_file.png

The standard "Search page template" looks like this:

<div>
  <a href="?id=form&sys_id={{item.sys_id}}&table={{item.table}}" class="h4 text-primary m-b-sm block">
    <span ng-bind-html="highlight(item.primary, data.q)"></span>
  </a>
  <span class="text-muted" ng-repeat="f in item.fields">
    <span class="m-l-xs m-r-xs" ng-if="!$first"> &middot; </span>
    {{f.label}}: <span ng-bind-html="highlight(f.display_value, data.q)"></span>
  </span>
</div>

The Result looks like this:

find_real_file.png

I tried a bit and found this "Search page template" to partially work: 

<div>
  <a href="?id=form&sys_id={{item.sys_id}}&table={{item.table}}" class="h4 text-primary m-b-sm block">
    <span ng-bind-html="highlight(item.primary, data.q)"></span>
  </a>
  <span class="text-muted">${Article}: {{item.fields.number}}</span>
  <span class="text-muted">${Article}: {{item.number}}</span>
  <span class="text-muted" ng-repeat="f in item.fields">
    <span class="m-l-xs m-r-xs" ng-if="!$first"> &middot; </span>
    <span class="text-muted">Test</span>
  </span>
</div>

with this result:

find_real_file.png

As you can see I can neither access the item variables through "item.fields.<x>", "item.<x>" nor a simple "Test" span does not work. "Item.sys_id" does resolve to the correct sys_id though.

How can I access the item variables? How can I adjust this search page template to my needs?

1 ACCEPTED SOLUTION

ServiceNow Tec2
Mega Sage
This has been resolved by ServiceNow Technical Support. Please refer to KB0715359 (HI login required) for more information.

View solution in original post

1 REPLY 1

ServiceNow Tec2
Mega Sage
This has been resolved by ServiceNow Technical Support. Please refer to KB0715359 (HI login required) for more information.