feat(Hubspot Node): Allow to set Stage on Ticket Update (#3317)

* Add HubSpot Ticket Update Stage

*  Small improvements

* 🐛 Fix merge issue

* 🐛 Fix use of wrong parameter name

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Bryce Sheehan
2022-06-20 10:46:55 +08:00
committed by GitHub
parent 6d64e84f5e
commit 0ac9e3f975
2 changed files with 23 additions and 1 deletions

View File

@@ -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, {});
@@ -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',