Skip to content

Commit fe16ca0

Browse files
seynadioclaude
andcommitted
Add assignee support to Zendesk update ticket component
- Add assigneeId prop with dynamic agent dropdown selection - Add assigneeEmail prop for email-based ticket assignment - Update ticket data to include assignee_id and assignee_email fields - Enhanced summary messages to reflect assignee updates - Maintain backward compatibility with optional props - Follow Zendesk API v2 specification for ticket updates 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f549ea4 commit fe16ca0

File tree

2 files changed

+84
-9
lines changed

2 files changed

+84
-9
lines changed

components/zendesk/actions/update-ticket/update-ticket.mjs

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ export default {
8989
optional: true,
9090
default: "set",
9191
},
92+
assigneeId: {
93+
propDefinition: [
94+
app,
95+
"assigneeId",
96+
],
97+
},
98+
assigneeEmail: {
99+
propDefinition: [
100+
app,
101+
"assigneeEmail",
102+
],
103+
},
92104
},
93105
methods: {
94106
updateTicket({
@@ -113,6 +125,8 @@ export default {
113125
attachments,
114126
ticketTags,
115127
tagAction,
128+
assigneeId,
129+
assigneeEmail,
116130
} = this;
117131

118132
const ticketComment = ticketCommentBodyIsHTML
@@ -143,24 +157,47 @@ export default {
143157
}
144158
}
145159

160+
// Build ticket data object
161+
const ticketData = {
162+
comment: ticketComment,
163+
priority: ticketPriority,
164+
subject: ticketSubject,
165+
status: ticketStatus,
166+
};
167+
168+
// Add assignee fields if provided
169+
if (assigneeId) {
170+
ticketData.assignee_id = assigneeId;
171+
}
172+
if (assigneeEmail) {
173+
ticketData.assignee_email = assigneeEmail;
174+
}
175+
146176
const response = await this.updateTicket({
147177
step,
148178
ticketId,
149179
customSubdomain,
150180
data: {
151-
ticket: {
152-
comment: ticketComment,
153-
priority: ticketPriority,
154-
subject: ticketSubject,
155-
status: ticketStatus,
156-
},
181+
ticket: ticketData,
157182
},
158183
});
159184

160185
const attachmentCount = ticketComment.uploads?.length || 0;
161-
const summary = attachmentCount > 0
162-
? `Successfully updated ticket with ID ${response.ticket.id} with ${attachmentCount} attachment(s)`
163-
: `Successfully updated ticket with ID ${response.ticket.id}`;
186+
const assigneeUpdated = assigneeId || assigneeEmail;
187+
188+
let summary = `Successfully updated ticket with ID ${response.ticket.id}`;
189+
190+
const updates = [];
191+
if (attachmentCount > 0) {
192+
updates.push(`${attachmentCount} attachment(s)`);
193+
}
194+
if (assigneeUpdated) {
195+
updates.push("assignee");
196+
}
197+
198+
if (updates.length > 0) {
199+
summary += ` with ${updates.join(" and ")}`;
200+
}
164201

165202
step.export("$summary", summary);
166203

components/zendesk/zendesk.app.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,44 @@ export default {
274274
description: "Array of tags to apply to the ticket. These will replace any existing tags on the ticket.",
275275
optional: true,
276276
},
277+
assigneeId: {
278+
type: "string",
279+
label: "Assignee ID",
280+
description: "The ID of the agent to assign the ticket to",
281+
optional: true,
282+
async options({ prevContext }) {
283+
const { afterCursor } = prevContext;
284+
285+
const {
286+
users,
287+
meta,
288+
} = await this.listUsers({
289+
params: {
290+
[constants.PAGE_SIZE_PARAM]: constants.DEFAULT_LIMIT,
291+
[constants.PAGE_AFTER_PARAM]: afterCursor,
292+
role: "agent",
293+
},
294+
});
295+
296+
return {
297+
context: {
298+
afterCursor: meta.after_cursor,
299+
},
300+
options: users.map(({
301+
id, name,
302+
}) => ({
303+
label: name,
304+
value: id,
305+
})),
306+
};
307+
},
308+
},
309+
assigneeEmail: {
310+
type: "string",
311+
label: "Assignee Email",
312+
description: "The email address of the agent to assign the ticket to",
313+
optional: true,
314+
},
277315
},
278316
methods: {
279317
getUrl(path, customSubdomain) {

0 commit comments

Comments
 (0)