Tickets & Conversations

Jun22
Participant

Service Hub Tickets - Priority Field not working

Need some help regarding the Ticket-Listing module I tried to add the priority ticket line but when viewing the page it only display 1 priority name e.g Priority 1 instead the other tickets are Priority 2 the loop might be the wrong ? 

Here's the screenshot 

 

Jun22_0-1656948963691.pngScreenShot Tool -20220704233229.png

 

And here's the code of that table at the top 

{% set user = request_contact.contact %}
{% set contact_id = user.hs_object_id %}
{% set company_id = request_contact.company.hs_object_id %}

<!-- Determine the appropriate search criteria based on the logged in Contact's "portal_role" value. -->
{% set company_or_contact_id = user.portal_role == "Super Admin" ? company_id : contact_id %}
{% set association_type_id = user.portal_role == "Super Admin" ? 25 : 15 %}

<!-- Retrieve the appropriate Tickets based on the above values. -->
{% set associated_tickets = crm_associations(company_or_contact_id, 'HUBSPOT_DEFINED', association_type_id,'limit=100&order=-createdate','subject, content, ticket_priority, hs_pipeline_stage, createdate, hs_lastmodifieddate, closed_date, hs_ticket_id, source_type', false) %}

<!-- Store the results in a variable. -->
{% set ticket_array = associated_tickets.results %}

<form class="cp-ticket-toolbar">
<div class="cp-ticket-search" role="search">
<label class="show-for-sr" for="cpSearch">{{ i18n_getmessage('search.description') }}</label>
<input id="cpSearch" type="search" name="subject" placeholder="{{ i18n_getmessage('search.placeholder') }}">
</div>

<div class="cp-ticket-filter">
<label class="cp-ticket-filter__label" id="cpFilterLabel" aria-label="{{ i18n_getmessage('filter.description') }}">{{ i18n_getmessage('filter.label') }}</label>

<div class="cp-ticket-filter__wrapper">
<select class="cp-ticket-filter__select-native" id="cpFilterNative" name="status" aria-labelledby="cpFilterLabel">
<option value="all">{{ i18n_getmessage('filter.all') }}</option>
<option value="open">{{ i18n_getmessage('filter.open') }}</option>
<option value="closed">{{ i18n_getmessage('filter.closed') }}</option>
</select>

<div class="cp-ticket-filter__select-custom" id="cpFilterCustom" aria-hidden="true">
<div class="cp-ticket-filter__trigger">{{ i18n_getmessage('filter.all') }}</div>
<div class="cp-ticket-filter__options">
<div class="cp-ticket-filter__option" data-value="all">{{ i18n_getmessage('filter.all') }}</div>
<div class="cp-ticket-filter__option" data-value="open">{{ i18n_getmessage('filter.open') }}</div>
<div class="cp-ticket-filter__option" data-value="closed">{{ i18n_getmessage('filter.closed') }}</div>
</div>
</div>
</div>
</div>
</form>

{# The id on the table is used for screenreaders/keyboard users to skip directly to the table's data on page load #}
<table class="cp-ticket-list tableticketLISTINGnew22" id="cpTicketList">
<caption></caption>
<thead>
<tr>
<th scope="col">{{ i18n_getmessage('tableHeader.id') }}</th>
<th scope="col">{{ i18n_getmessage('tableHeader.subject') }}</th>
<th scope="col">{{ i18n_getmessage('tableHeader.lastActivity') }}</th>
<th scope="col">Priority</th>
<th scope="col">{{ i18n_getmessage('tableHeader.status') }}</th>
<th scope="col">{{ i18n_getmessage('tableHeader.created') }}</th>

</tr>
</thead>
<tbody id="cpTicketTableBody" class="tableorig2022">
{% if ticket_array|length > 0 %}
{% for ticket in ticket_array %}
{% if ticket.source_type != "CHAT" and ticket.source_type != "Support Automation" and ticket.source_type != "Internal" and ticket.source_type != "Community" and ticket.source_type != "PS" and ticket.source_type != "Chatter"%}
<tr id="cpTicketRowTemplate" class="hidden cp-ticket-row-clickable">
<td class="cp-ticket-id"></td>
<td class="cp-ticket-subject"><a class="cp-ticket-subject__link"></a></td>
<td class="cp-ticket-last-activity"><span aria-hidden="true">{{ i18n_getmessage('tableHeader.lastActivity') }}</span></td>
{% if ticket.ticket_priority == "Priority 1"%}
<td data-label="PRIORITY">
<span class="badge badge-pill p1">{{ticket.ticket_priority}}</span>
</td>
{% elif ticket.ticket_priority == "Priority 2"%}
<td data-label="PRIORITY">
<span class="badge badge-pill p2">{{ticket.ticket_priority}}</span>
</td>
{% elif ticket.ticket_priority == "Priority 3"%}
<td data-label="PRIORITY">
<span class="badge badge-pill p3">{{ticket.ticket_priority}}</span>
</td>
{% elif ticket.ticket_priority == "Priority 4"%}
<td data-label="PRIORITY">
<span class="badge badge-pill p4">{{ticket.ticket_priority}}</span>
</td>
{% else %}
<td data-label="PRIORITY">
{{ticket.ticket_priority}}
</td>
{% endif %}
<td class="cp-ticket-status"></td>
<td class="cp-ticket-created"><span aria-hidden="true">{{ i18n_getmessage('tableHeader.created') }}</span></td>




</tr>

{% endif %}
{% endfor %}
{% endif %}
</tbody>
</table>

<div id="cpLoadingSpinnerTemplate" class="hidden">
<div class="cp-loading-spinner">
<div class="cp-loading-spinner__inner" />
</div>
</div>

<div id="cpPaginationButtonTemplate" class="hidden">
<li class="cp-ticket-pagination-button" data-page-number="1">
<a class="cp-ticket-pagination-button__link" aria-label="Page 1">
1
</a>
</li>
</div>


<nav aria-label="Ticket Pagination" class="cp-ticket-pagination cp-ticket-pagination--hidden" id="cpTicketPagination">
<ul>
<li id="cpTicketPaginationPrev" class="cp-ticket-pagination-button">
<a class="cp-ticket-pagination-button__link" aria-label="{{ i18n_getmessage('pagination.previousPageLabel') }}">
{% icon
name='chevron-left'
purpose='decorative',
style='SOLID'
unicode='f053',
no_wrapper=True
%}
{{ i18n_getmessage('pagination.previousPage') }}
</a>
</li>
<ul id="cpPaginationPageButtons"></ul>
<li id="cpTicketPaginationNext" class="cp-ticket-pagination-button">
<a class="cp-ticket-pagination-button__link" aria-label="{{ i18n_getmessage('pagination.nextPageLabel') }}">
{{ i18n_getmessage('pagination.nextPage') }}
{% icon
name='chevron-right'
purpose='decorative',
style='SOLID'
unicode='f054',
no_wrapper=True
%}
</a>
</li>
</ul>
</nav>

 

0 Upvotes
1 Reply 1
JPanama
HubSpot Moderator
HubSpot Moderator

Service Hub Tickets - Priority Field not working

Hi @Jun22

 

Thanks for getting in touch! Generally speaking it's not often that Community members would get the time to troubleshoot somebody's code, you might find the Developer Slack Community a better place to start. If you have a Paid HubSpot Subscription and believe there might be something wrong with some HubSpot code, our Support channels can certainly help you there. 

 

I'll tag in some Community members with more expertise in this area who might be able to see the issue. @Teun@Kevin-C@miljkovicmisa any thoughts? 

 

Best, 
Joe (HubSpot Support)