Improve Autotask customer mapping with auto-search
Added automatic search for similar company names when opening unmapped customers in the edit modal. This speeds up the mapping process by eliminating manual searches. Changes: - Clear search box when opening customer edit modal - Auto-populate search with customer name for unmapped customers - Automatically display matching Autotask companies as suggestions - Refactor search logic into reusable performAutotaskSearch() function Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
282d34af2d
commit
9388ec4c01
@ -370,6 +370,7 @@
|
|||||||
if (atResults) {
|
if (atResults) {
|
||||||
clearResults();
|
clearResults();
|
||||||
}
|
}
|
||||||
|
if (atSearchInput) atSearchInput.value = '';
|
||||||
setSelectedCompanyId(null);
|
setSelectedCompanyId(null);
|
||||||
setMsg("", false);
|
setMsg("", false);
|
||||||
|
|
||||||
@ -379,13 +380,21 @@
|
|||||||
var atStatus = btn.getAttribute("data-autotask-mapping-status") || "";
|
var atStatus = btn.getAttribute("data-autotask-mapping-status") || "";
|
||||||
var atLast = btn.getAttribute("data-autotask-last-sync-at") || "";
|
var atLast = btn.getAttribute("data-autotask-last-sync-at") || "";
|
||||||
renderCurrentMapping(atCompanyId, atCompanyName, atStatus, atLast);
|
renderCurrentMapping(atCompanyId, atCompanyName, atStatus, atLast);
|
||||||
|
|
||||||
|
// Auto-search for similar companies if not yet mapped
|
||||||
|
if (!atCompanyId && name && atSearchInput) {
|
||||||
|
atSearchInput.value = name;
|
||||||
|
performAutotaskSearch(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (atSearchBtn && atSearchInput && atResults) {
|
// Reusable Autotask search function
|
||||||
atSearchBtn.addEventListener("click", async function () {
|
async function performAutotaskSearch(query) {
|
||||||
var q = (atSearchInput.value || "").trim();
|
if (!atResults) return;
|
||||||
|
|
||||||
|
var q = (query || "").trim();
|
||||||
if (!q) {
|
if (!q) {
|
||||||
setMsg("Enter a search term.", true);
|
setMsg("Enter a search term.", true);
|
||||||
return;
|
return;
|
||||||
@ -439,6 +448,12 @@
|
|||||||
atResults.innerHTML = "<div class=\"text-muted small\">No results.</div>";
|
atResults.innerHTML = "<div class=\"text-muted small\">No results.</div>";
|
||||||
setMsg(e && e.message ? e.message : "Search failed.", true);
|
setMsg(e && e.message ? e.message : "Search failed.", true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atSearchBtn && atSearchInput && atResults) {
|
||||||
|
atSearchBtn.addEventListener("click", async function () {
|
||||||
|
var q = (atSearchInput.value || "").trim();
|
||||||
|
await performAutotaskSearch(q);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,10 @@ This file documents all changes made to this project via Claude Code.
|
|||||||
## [2026-02-05]
|
## [2026-02-05]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- Autotask customer mapping now auto-searches for similar company names when opening unmapped customers:
|
||||||
|
- Automatically populates search box with customer name
|
||||||
|
- Displays matching Autotask companies as suggestions
|
||||||
|
- Speeds up mapping process by eliminating manual search for most customers
|
||||||
- Autotask "Link existing ticket" now supports cross-company ticket search:
|
- Autotask "Link existing ticket" now supports cross-company ticket search:
|
||||||
- Added `query_tickets_by_number()` to search tickets by number across all companies
|
- Added `query_tickets_by_number()` to search tickets by number across all companies
|
||||||
- When searching with a ticket number (e.g., "T20260205.0001"), results include:
|
- When searching with a ticket number (e.g., "T20260205.0001"), results include:
|
||||||
@ -29,6 +33,7 @@ This file documents all changes made to this project via Claude Code.
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Autotask "Link existing" search box now clears when opening the modal instead of retaining previous search text
|
- Autotask "Link existing" search box now clears when opening the modal instead of retaining previous search text
|
||||||
|
- Autotask customer mapping search box now clears when opening the edit modal instead of retaining previous search text
|
||||||
- Autotask ticket resolution update now correctly preserves exact field values from GET response in PUT payload.
|
- Autotask ticket resolution update now correctly preserves exact field values from GET response in PUT payload.
|
||||||
The `issueType`, `subIssueType`, and `source` fields are copied with their exact values (including null)
|
The `issueType`, `subIssueType`, and `source` fields are copied with their exact values (including null)
|
||||||
from the GET response, as required by Autotask API. Previously these fields were being skipped or modified.
|
from the GET response, as required by Autotask API. Previously these fields were being skipped or modified.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user