Good morning everyone!
I need to edit in Portal: Customer Service - Support Home.
Currently I have a portal with which several Customers work and I need the Global Search to filter by customer belonging to the logged in contact.
I have revised the standard configuration and due to design limitations it cannot be done.
I thought that with a fetch I could add the filter, I have the fetch, but I don't know how to modify the code in the web template, nor how to fill in the list of results that the template shows.
Template Web code:
{% extends 'layout_1_column' %}
{% block main %}
{% include 'page_copy' %}
{% assign created = request.params['created'] %}
{% if created %}
<div class='alert alert-block alert-success alert-case-created'><p>{% editable snippets 'CustomerService/Support/A_Case' type: 'text', default: resx['CustomerService_Support_A_Case'], escape: true %}{{ created | h }}{% editable snippets 'CustomerService/Support/CaseCreated' type: 'text', default: resx['CustomerService_Support_Case_Created'], escape: true , tag: 'span' %}</p></div>
{% endif %}
<div class="case-deflection">
<div class="content-panel panel panel-default">
<div class="panel-heading">
<span aria-hidden="true" class="fa fa-search"></span> {% editable snippets 'CustomerService/Support/HelpQuestion' type: 'text', default: resx['CustomerService_Support_Help_Question'], escape: true , tag: 'span'%}
</div>
<div class="panel-body">
<div class="input-group">
<div class="input-group-btn search-clear-container">
<button type="button" class="btn btn-default search-clear" title="{{ snippets['CustomerService/Support/ClearButton'] | default: resx['CustomerService_Support_ClearButton'] | h }}">
<span aria-hidden="true" class="fa fa-times"></span>
</button>
</div>
<input aria-label="{{ snippets['CustomerService/Support/HelpQuestion'] | default: resx['CustomerService_Support_Help_Question'] | h }}" title="{{ snippets['CustomerService/Support/FailedLogin'] | default: resx['CustomerService_Support_FailedLogin'] | h }}" type="text" class="form-control subject case-deflection" data-container=".case-deflection" data-target="#case-deflection-topics" data-template="#case-deflection-results" data-itemtemplate="#case-deflection-results" data-case-deflection-pagesize="5" data-case-deflection-logicalnames="knowledgearticle,incident,adx_issue,adx_webpage,adx_communityforumthread,adx_communityforumpost,kbarticle" data-case-deflection-query="" data-case-deflection-filter="" data-noresultstext="{{ snippets['CustomerService/Support/NoResults'] | default: resx['CustomerService_Support_NoResults'] | h }}" placeholder="{{ snippets['CustomerService/Support/FailedLogin'] | default: resx['CustomerService_Support_FailedLogin'] | h }}" />
<div class="input-group-btn">
<button type="button" class="btn btn-default search-apply" aria-label="{{ snippets['CustomerService/Support/SearchButton'] | default: resx['CustomerService_Support_SearchButton'] | h }}" title="{{ snippets['CustomerService/Support/SearchButton'] | default: resx['CustomerService_Support_SearchButton'] | h }}">
<span aria-hidden="true" class="fa fa-search"></span>
</button>
</div>
</div>
</div>
<ul class="list-group" id="case-deflection-topics"></ul>
<div class='panel-footer paging clearfix'>
<button type="button" class="btn btn-default search-more pull-right"><span class='fa fa-plus'></span>
{% editable snippets 'CustomerService/Support/ShowMore' type: 'text', default: resx['CustomerService_Support_ShowMore'], escape: true, tag: 'span' %}</button>
</div>
</div>
</div>
{% if user %}
{% include 'entity_list' key:page.adx_entitylist.id %}
{% else %}
<div class='alert alert-block alert-info'><p><span class='fa fa-info-circle'></span>{% editable snippets 'CustomerService/Support/SignIn' type: 'text', default: resx['CustomerService_Support_PleaseSignIn'], escape: true, tag: 'span' %}</p></div>
{% endif %}
{% raw %}
<script type="text/javascript">
(function ($) {
$(document).ready(function () {
setTimeout(function() {
$(".alert-case-created").slideUp(100);
}, 5000);
});
}(jQuery));
</script>
<script id="case-deflection-results" type="text/x-handlebars-template">
{{# each items}}
<li class="list-group-item">
<h4 class="list-group-item-heading"><a href="{{ url }}">{{ title }}</a></h4>
<p class="list-group-item-text search-results fragment">{{{ fragment }}}</p>
<div>
{{#label entityLogicalName 'adx_communityforum'}}
<span class='label label-info'>{% endraw %}{{ resx['Forums_Label']}}{% raw %}</span>
{{/label}}
{{#label entityLogicalName 'adx_communityforumthread'}}
<span class='label label-info'>{% endraw %}{{ resx['Forums_Label'] }}{% raw %}</span>
{{/label}}
{{#label entityLogicalName 'adx_communityforumpost'}}
<span class='label label-info'>{% endraw %}{{ resx['Forums_Label'] }}{% raw %}</span>
{{/label}}
{{#label entityLogicalName 'adx_event'}}
<span class='label label-info'>{% endraw %} {{ resx['Events_Label'] }} {% raw %}</span>
{{/label}}
{{#label entityLogicalName 'adx_eventschedule'}}
<span class='label label-info'>{% endraw %} {{ resx['Events_Label'] }} {% raw %}</span>
{{/label}}
{{#label entityLogicalName 'adx_issue'}}
<span class='label label-danger'>{% endraw %} {{ resx['Issues_Label'] }} {% raw %}</span>
{{/label}}
{{#label entityLogicalName 'incident'}}
<span class='label label-success'>{% endraw %} {{ resx['Resolved_Cases_Label'] }} {% raw %}</span>
{{/label}}
{{#label entityLogicalName 'kbarticle'}}
<span class='label label-primary'>{% endraw %} {{ resx['Knowledge_Base_Label'] }} {% raw %}</span>
{{/label}}
{{#label entityLogicalName 'knowledgearticle'}}
<span class='label label-primary'>{% endraw %} {{ resx['Knowledge_Base_Label']}} {% raw %}</span>
{{/label}}
</div>
</li>
{{/each}}
</script>
{% endraw %}
{% endblock %}
My fetchxml:
<?xml version="1.0"?>
-<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">
-<entity name="incident">
<attribute name="title"/>
<attribute name="ticketnumber"/>
<attribute name="createdon"/>
<attribute name="caseorigincode"/>
<attribute name="incidentid"/>
<order descending="false" attribute="title"/>
<filter type="and">
<condition attribute="customerid" uitype="account" value="((paramId)) operator="eq"/>
</filter>
</entity>
</fetch>