";
-
- try {
- var resp = await fetch("/api/autotask/companies/search?q=" + encodeURIComponent(q), {
- method: "GET",
- credentials: "same-origin",
- });
- var data = await resp.json();
- if (!resp.ok || !data || data.status !== "ok") {
- throw new Error((data && data.message) ? data.message : "Search failed.");
- }
- var items = data.items || [];
- if (!items.length) {
- atResults.innerHTML = "
No companies found.
";
- setMsg("No companies found.", false);
- return;
- }
- var html = "";
- items.forEach(function (it) {
- var cid = it.id;
- var name = it.companyName || it.name || ("Company #" + cid);
- var active = (it.isActive === false) ? " (inactive)" : "";
- html +=
- "
" +
- "" +
- "" +
- "
";
- });
- atResults.innerHTML = html;
-
- var radios = atResults.querySelectorAll("input[name='autotaskCompanyPick']");
- radios.forEach(function (r) {
- r.addEventListener("change", function () {
- setSelectedCompanyId(r.value);
- setMsg("Selected company ID: " + r.value, false);
- });
- });
-
- setMsg("Select a company and click Set mapping.", false);
- } catch (e) {
- atResults.innerHTML = "
No results.
";
- setMsg(e && e.message ? e.message : "Search failed.", true);
- }
+ await performAutotaskSearch(q);
});
}
diff --git a/docs/changelog-claude.md b/docs/changelog-claude.md
index 53892d1..d8fe517 100644
--- a/docs/changelog-claude.md
+++ b/docs/changelog-claude.md
@@ -5,6 +5,10 @@ This file documents all changes made to this project via Claude Code.
## [2026-02-05]
### 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:
- 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:
@@ -29,6 +33,7 @@ This file documents all changes made to this project via Claude Code.
### Fixed
- 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.
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.