Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(connectors): address PR review comments for hubspot, jira, salesf…
…orce

- HubSpot: revert to Search API (POST /search) to restore lastmodifieddate DESCENDING sorting
- Salesforce: restore ArticleBody field and add it to HTML_FIELDS for proper stripping
- Jira: add zero-remaining guard to prevent requesting 0 maxResults
  • Loading branch information
waleedlatif1 committed Mar 15, 2026
commit 839c00aeea2f81a62fdddeed1caf37ccba9a487a
32 changes: 16 additions & 16 deletions apps/sim/connectors/hubspot/hubspot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,28 +223,28 @@ export const hubspotConnector: ConnectorConfig = {

const portalId = await getPortalId(accessToken, syncContext)

const params = new URLSearchParams({
limit: String(PAGE_SIZE),
})
for (const prop of properties) {
params.append('properties', prop)
const sortProperty = objectType === 'contacts' ? 'lastmodifieddate' : 'hs_lastmodifieddate'

const searchBody: Record<string, unknown> = {
properties,
sorts: [{ propertyName: sortProperty, direction: 'DESCENDING' }],
limit: PAGE_SIZE,
}
if (cursor) {
params.set('after', cursor)
searchBody.after = cursor
}

logger.info(`Listing HubSpot ${objectType}`, { cursor })

const response = await fetchWithRetry(
`${BASE_URL}/crm/v3/objects/${objectType}?${params.toString()}`,
{
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`,
},
}
)
const response = await fetchWithRetry(`${BASE_URL}/crm/v3/objects/${objectType}/search`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`,
},
body: JSON.stringify(searchBody),
})

if (!response.ok) {
const errorText = await response.text()
Expand Down
5 changes: 4 additions & 1 deletion apps/sim/connectors/jira/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ export const jiraConnector: ConnectorConfig = {
const params = new URLSearchParams()
params.append('jql', jql)
params.append('startAt', String(startAt))
const remaining = maxIssues > 0 ? maxIssues - startAt : PAGE_SIZE
const remaining = maxIssues > 0 ? Math.max(0, maxIssues - startAt) : PAGE_SIZE
Comment thread
waleedlatif1 marked this conversation as resolved.
if (remaining === 0) {
return { documents: [], hasMore: false }
}
params.append('maxResults', String(Math.min(PAGE_SIZE, remaining)))
params.append(
'fields',
Expand Down
11 changes: 9 additions & 2 deletions apps/sim/connectors/salesforce/salesforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ const PAGE_SIZE = 200

/** SOQL field lists per object type. */
const OBJECT_FIELDS: Record<string, string[]> = {
KnowledgeArticleVersion: ['Id', 'Title', 'Summary', 'LastModifiedDate', 'ArticleNumber'],
KnowledgeArticleVersion: [
'Id',
'Title',
'Summary',
'ArticleBody',
'LastModifiedDate',
'ArticleNumber',
],
Case: ['Id', 'Subject', 'Description', 'Status', 'LastModifiedDate', 'CaseNumber'],
Account: ['Id', 'Name', 'Description', 'Industry', 'LastModifiedDate'],
Opportunity: [
Expand Down Expand Up @@ -92,7 +99,7 @@ function buildRecordTitle(objectType: string, record: Record<string, unknown>):
}

/** Fields that may contain HTML content and should be stripped to plain text. */
const HTML_FIELDS = new Set(['Description', 'Summary'])
const HTML_FIELDS = new Set(['Description', 'Summary', 'ArticleBody'])

/**
* Builds plain-text content from a Salesforce record for indexing.
Expand Down
Loading