Files
sim/apps
Waleed 32b380fd37 improvement(salesforce): align tools + block with Salesforce API and harden CRUD/analytics (#5040)
* improvement(salesforce): align tools + block with Salesforce API and harden CRUD/analytics

- Migrate all 4 Account tools to shared getInstanceUrl + extractErrorMessage helpers (drop ~40 lines of inlined idToken decode per file)
- Use extractErrorMessage consistently across every CRUD tool; add loggers to the opportunity tools
- Trim ID path params on all update/delete/single-get tools; URL-encode single-record field lists
- Fix dashboard tools: read name/metadata from dashboardMetadata.attributes (was always null); refresh now returns status/statusUrl defensively; drop no-op list_dashboards folderName filter
- Expose update_case origin/contact/account and update_task who/what fields end-to-end
- Block: mark create-required (Name, LastName, Company, StageName, Subject) and update/delete IDs conditionally required; add account billing*/revenue/employees and contact mailing*/department subBlocks; convert includeDetails to a Yes/No dropdown; move optional fields to advanced mode
- Trim over-declared dashboard output types; make Task.Status optional
- Regenerate integration docs

* fix(salesforce): correct list/refresh response shapes per live API docs

- list_dashboards: GET /analytics/dashboards returns a bare top-level array, not a {dashboards} wrapper (fixes always-empty result)
- refresh_dashboard: statusUrl is returned at the top level of the PUT response, read it there first
- list_reports: the list resource only returns report name/id/url/describeUrl/instancesUrl, so drop the no-op folderName filter and match searchTerm on name only

Validated tool-by-tool against the live Salesforce REST/Analytics/Object-Reference docs (API v67.0).

* fix(salesforce): address Greptile/Cursor review

- Add shared requireId() guard so whitespace-only IDs fail fast instead of producing malformed /sobjects/Object/ empty-path requests (all update/delete/single-get tools)
- URL-encode the fields query value in get_opportunities and get_tasks single-record GETs (matching the other get_* tools)
- Reflect the Salesforce API success flag consistently across all create tools (success/created use data.success === true)

* fix(salesforce): trim echoed output IDs and relation reference IDs

- update/delete tools now return output.id from the trimmed ID so chained workflows never receive whitespace-padded IDs
- trim relation reference IDs (AccountId, ContactId, WhoId, WhatId) in create/update bodies to avoid Salesforce reference errors from copy-pasted whitespace

* fix(salesforce): trim accountId in update_contact body

Last remaining untrimmed relation reference ID — update_contact now trims AccountId like the other create/update tools.
2026-06-13 20:21:45 -07:00
..