Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HubSpot Ticket Update Stage - N8N-3707 #3317

Merged
merged 5 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 10 additions & 1 deletion packages/nodes-base/nodes/Hubspot/Hubspot.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,10 @@ export class Hubspot implements INodeType {
// Get all the ticket stages to display them to user so that he can
// select them easily
async getTicketStages(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const currentPipelineId = this.getCurrentNodeParameter('pipelineId') as string;
let currentPipelineId = this.getCurrentNodeParameter('pipelineId') as string;
if (currentPipelineId === undefined) {
currentPipelineId = this.getNodeParameter('updateFields.pipelineId', '') as string;
}
const returnData: INodePropertyOptions[] = [];
const endpoint = '/crm-pipelines/v1/pipelines/tickets';
const { results } = await hubspotApiRequest.call(this, 'GET', endpoint, {});
Expand Down Expand Up @@ -2471,6 +2474,12 @@ export class Hubspot implements INodeType {
value: updateFields.pipelineId as string,
});
}
if (updateFields.stageId) {
body.push({
name: 'hs_pipeline_stage',
value: updateFields.stageId as string,
});
}
if (updateFields.ticketName) {
body.push({
name: 'subject',
Expand Down
13 changes: 13 additions & 0 deletions packages/nodes-base/nodes/Hubspot/TicketDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,19 @@ export const ticketFields: INodeProperties[] = [
default: '',
description: 'Channel where ticket was originally submitted. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
{
displayName: 'Stage Name or ID',
name: 'stageId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTicketStages',
loadOptionsDependsOn: [
'updateFields.pipelineId',
],
},
default: '',
description: 'The stage ID of the pipeline the ticket is in; depends on Pipeline ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.',
},
{
displayName: 'Ticket Name',
name: 'ticketName',
Expand Down