fix(helpdesk): remove unavailable fields from LV ticket query
PBI_LV_Tickets does not expose Description or Company_Contact_Name — BC returns HTTP 400 on unknown select fields. Revert to original LV field set. Description falls back to Category_1_Code. Customer column shows Customer_No when Company_Contact_Name is unavailable. Show API error message in UI for debugging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -599,7 +599,7 @@ class BcODataGateway
|
||||
{
|
||||
$url = $this->settingsGateway->buildEntityUrl(self::ENTITY_TICKETS_LV)
|
||||
. '?$top=500'
|
||||
. '&$select=' . rawurlencode('No,Customer_No,Category_1_Code,Escalation_Code,Ticket_State,Last_Activity_Date,Created_On,Process_Stage,Process_Code,Support_User_Name,Description,Company_Contact_Name')
|
||||
. '&$select=' . rawurlencode('No,Customer_No,Category_1_Code,Escalation_Code,Ticket_State,Last_Activity_Date,Created_On,Process_Stage,Process_Code,Support_User_Name')
|
||||
. '&$orderby=' . rawurlencode('Created_On desc');
|
||||
|
||||
$response = $this->request('GET', $url);
|
||||
|
||||
@@ -1658,7 +1658,7 @@ class DebitorDetailService
|
||||
|
||||
$agents[$normalizedUser]['open_ticket_details'][] = [
|
||||
'no' => trim((string) ($ticket['No'] ?? '')),
|
||||
'description' => trim((string) ($ticket['Description'] ?? '')),
|
||||
'description' => trim((string) ($ticket['Description'] ?? (string) ($ticket['Category_1_Code'] ?? ''))),
|
||||
'age_hours' => $ageHours,
|
||||
'critical' => $isCritical,
|
||||
'customer_name' => trim((string) ($ticket['Company_Contact_Name'] ?? '')),
|
||||
|
||||
@@ -206,7 +206,15 @@ if (container) {
|
||||
const res = await fetch(dataUrl + '?' + params.toString(), { credentials: 'same-origin' });
|
||||
const json = await res.json();
|
||||
|
||||
if (!json.ok) { showState('error'); return; }
|
||||
if (!json.ok) {
|
||||
console.error('[helpdesk-team] API error:', json.error || json);
|
||||
if (elError) {
|
||||
const p = elError.querySelector('p');
|
||||
if (p && json.error) p.textContent = json.error;
|
||||
}
|
||||
showState('error');
|
||||
return;
|
||||
}
|
||||
if (!json.members || json.members.length === 0) { showState('empty'); return; }
|
||||
|
||||
renderCurrentTab(json.members);
|
||||
|
||||
Reference in New Issue
Block a user