Skip to content

Commit 98a37b5

Browse files
committed
fix(zoho-desk): keep the legacy include working on Get Ticket
Splitting the shared `include` subBlock into `include` and `ticketInclude` left workflows saved before the split reading an empty field, so their Get Ticket calls silently stopped embedding what they asked for. Get Ticket now reads `ticketInclude ?? include`. The fallback only goes that direction: Get Ticket accepts every value List Tickets does plus `contract` and `skills`, so a legacy value is always valid there, while List Tickets still reads only `include` and can never receive the two extra tokens it does not document.
1 parent f5c2023 commit 98a37b5

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

apps/sim/blocks/blocks/zoho-desk.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,17 @@ export const ZohoDeskBlock: BlockConfig<ZohoDeskResponse> = {
669669
: undefined
670670
result.sortBy = orUndefined(activeSortBy)
671671

672+
// Get Ticket falls back to the legacy shared `include`: workflows saved
673+
// before the split stored their value there, and dropping it would
674+
// silently stop embedding what they asked for. The fallback is one-way
675+
// and safe - Get Ticket accepts every value List Tickets does, plus
676+
// `contract` and `skills` - while List Tickets never reads
677+
// `ticketInclude`, so those two extra tokens can still never reach it.
672678
const activeInclude =
673679
params.operation === 'list_tickets'
674680
? rawInclude
675681
: params.operation === 'get_ticket'
676-
? rawTicketInclude
682+
? (orUndefined(rawTicketInclude) ?? rawInclude)
677683
: params.operation === 'get_contact'
678684
? rawContactInclude
679685
: params.operation === 'get_thread'

apps/sim/tools/zoho_desk/list_tickets.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,27 @@ describe('ZohoDeskBlock keeps the two include vocabularies apart', () => {
117117
it('never leaks skills onto the list endpoint', () => {
118118
expect(merged('list_tickets').include).not.toContain('skills')
119119
})
120+
121+
// A workflow saved before the split stored its value under `include`. Dropping
122+
// it would silently stop embedding what the workflow asked for.
123+
it('falls back to the legacy include for a workflow saved before the split', () => {
124+
if (!buildParams) throw new Error('ZohoDeskBlock is missing tools.config.params')
125+
const legacy = { operation: 'get_ticket', ticketId: '1', include: 'contacts,products' }
126+
const result = { ...legacy, ...(buildParams(legacy) as Record<string, unknown>) }
127+
expect(result.include).toBe('contacts,products')
128+
})
129+
130+
it('prefers the new field once the workflow sets it', () => {
131+
if (!buildParams) throw new Error('ZohoDeskBlock is missing tools.config.params')
132+
const both = {
133+
operation: 'get_ticket',
134+
ticketId: '1',
135+
include: 'contacts',
136+
ticketInclude: 'skills',
137+
}
138+
const result = { ...both, ...(buildParams(both) as Record<string, unknown>) }
139+
expect(result.include).toBe('skills')
140+
})
120141
})
121142

122143
/**

0 commit comments

Comments
 (0)