mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add label field to persons, organizations and deals (#1209)
* ⚡ Add label field to persons, organizations and deals * ⚡ Add option no label to label field * ⚡ Add organization:update operation * ⚡ Fix removing label from Organization on Pipedrive-Node Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
83aed4d2b9
commit
da450dcb41
|
@ -75,7 +75,6 @@ export async function pipedriveApiRequest(this: IHookFunctions | IExecuteFunctio
|
||||||
}
|
}
|
||||||
|
|
||||||
query.api_token = credentials.apiToken;
|
query.api_token = credentials.apiToken;
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
responseData = await this.helpers.request(options);
|
responseData = await this.helpers.request(options);
|
||||||
|
|
||||||
|
|
|
@ -353,12 +353,11 @@ export class Pipedrive implements INodeType {
|
||||||
value: 'getAll',
|
value: 'getAll',
|
||||||
description: 'Get data of all organizations',
|
description: 'Get data of all organizations',
|
||||||
},
|
},
|
||||||
// TODO: Currently missing
|
{
|
||||||
// {
|
name: 'Update',
|
||||||
// name: 'Update',
|
value: 'update',
|
||||||
// value: 'update',
|
description: 'Update an organization',
|
||||||
// description: 'Update an organization',
|
},
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
|
@ -840,6 +839,48 @@ export class Pipedrive implements INodeType {
|
||||||
default: 'USD',
|
default: 'USD',
|
||||||
description: 'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...',
|
description: 'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customProperties',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'property',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the property to set.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Property Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value of the property to set.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getDealLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Lost Reason',
|
displayName: 'Lost Reason',
|
||||||
name: 'lost_reason',
|
name: 'lost_reason',
|
||||||
|
@ -935,39 +976,6 @@ export class Pipedrive implements INodeType {
|
||||||
default: '3',
|
default: '3',
|
||||||
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Custom Properties',
|
|
||||||
name: 'customProperties',
|
|
||||||
placeholder: 'Add Custom Property',
|
|
||||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
|
||||||
type: 'fixedCollection',
|
|
||||||
typeOptions: {
|
|
||||||
multipleValues: true,
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'property',
|
|
||||||
displayName: 'Property',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
displayName: 'Property Name',
|
|
||||||
name: 'name',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Name of the property to set.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Property Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Value of the property to set.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1082,6 +1090,48 @@ export class Pipedrive implements INodeType {
|
||||||
default: 'USD',
|
default: 'USD',
|
||||||
description: 'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...',
|
description: 'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customProperties',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'property',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the property to set.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Property Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value of the property to set.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getDealLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Lost Reason',
|
displayName: 'Lost Reason',
|
||||||
name: 'lost_reason',
|
name: 'lost_reason',
|
||||||
|
@ -1177,39 +1227,6 @@ export class Pipedrive implements INodeType {
|
||||||
default: '3',
|
default: '3',
|
||||||
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Custom Properties',
|
|
||||||
name: 'customProperties',
|
|
||||||
placeholder: 'Add Custom Property',
|
|
||||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
|
||||||
type: 'fixedCollection',
|
|
||||||
typeOptions: {
|
|
||||||
multipleValues: true,
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'property',
|
|
||||||
displayName: 'Property',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
displayName: 'Property Name',
|
|
||||||
name: 'name',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Name of the property to set.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Property Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Value of the property to set.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1613,23 +1630,6 @@ export class Pipedrive implements INodeType {
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
displayName: 'Visible to',
|
|
||||||
name: 'visible_to',
|
|
||||||
type: 'options',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Owner & followers (private)',
|
|
||||||
value: '1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Entire company (shared)',
|
|
||||||
value: '3',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: '3',
|
|
||||||
description: 'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayName: 'Custom Properties',
|
displayName: 'Custom Properties',
|
||||||
name: 'customProperties',
|
name: 'customProperties',
|
||||||
|
@ -1663,6 +1663,32 @@ export class Pipedrive implements INodeType {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getOrganizationLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Visible to',
|
||||||
|
name: 'visible_to',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Owner & followers (private)',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Entire company (shared)',
|
||||||
|
value: '3',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: '3',
|
||||||
|
description: 'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1710,6 +1736,120 @@ export class Pipedrive implements INodeType {
|
||||||
description: 'ID of the organization to get.',
|
description: 'ID of the organization to get.',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// organization:update
|
||||||
|
// ----------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Organization ID',
|
||||||
|
name: 'organizationId',
|
||||||
|
type: 'number',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'organization',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the organization to create',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Update Fields',
|
||||||
|
name: 'updateFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'organization',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customProperties',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'property',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the property to set.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Property Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value of the property to set.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getOrganizationLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Organization name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Owner ID',
|
||||||
|
name: 'owner_id',
|
||||||
|
type: 'number',
|
||||||
|
default: 0,
|
||||||
|
description: 'The ID of the user who will be marked as the owner of this Organization. When omitted, the authorized User ID will be used.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Visible to',
|
||||||
|
name: 'visible_to',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Owner & followers (private)',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Entire company (shared)',
|
||||||
|
value: '3',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: '3',
|
||||||
|
description: 'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1754,6 +1894,39 @@ export class Pipedrive implements INodeType {
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customProperties',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'property',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the property to set.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Property Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value of the property to set.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Email',
|
displayName: 'Email',
|
||||||
name: 'email',
|
name: 'email',
|
||||||
|
@ -1764,6 +1937,15 @@ export class Pipedrive implements INodeType {
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Email of the person.',
|
description: 'Email of the person.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getPersonLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Organization ID',
|
displayName: 'Organization ID',
|
||||||
name: 'org_id',
|
name: 'org_id',
|
||||||
|
@ -1798,39 +1980,6 @@ export class Pipedrive implements INodeType {
|
||||||
default: '3',
|
default: '3',
|
||||||
description: 'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
description: 'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Custom Properties',
|
|
||||||
name: 'customProperties',
|
|
||||||
placeholder: 'Add Custom Property',
|
|
||||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
|
||||||
type: 'fixedCollection',
|
|
||||||
typeOptions: {
|
|
||||||
multipleValues: true,
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'property',
|
|
||||||
displayName: 'Property',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
displayName: 'Property Name',
|
|
||||||
name: 'name',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Name of the property to set.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Property Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Value of the property to set.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1917,6 +2066,39 @@ export class Pipedrive implements INodeType {
|
||||||
},
|
},
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Custom Properties',
|
||||||
|
name: 'customProperties',
|
||||||
|
placeholder: 'Add Custom Property',
|
||||||
|
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'property',
|
||||||
|
displayName: 'Property',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Property Name',
|
||||||
|
name: 'name',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Name of the property to set.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Property Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'Value of the property to set.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Email',
|
displayName: 'Email',
|
||||||
name: 'email',
|
name: 'email',
|
||||||
|
@ -1927,6 +2109,15 @@ export class Pipedrive implements INodeType {
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Email of the person.',
|
description: 'Email of the person.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Label',
|
||||||
|
name: 'label',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getPersonLabels',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Name',
|
displayName: 'Name',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
@ -1968,39 +2159,6 @@ export class Pipedrive implements INodeType {
|
||||||
default: '3',
|
default: '3',
|
||||||
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
description: 'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Custom Properties',
|
|
||||||
name: 'customProperties',
|
|
||||||
placeholder: 'Add Custom Property',
|
|
||||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
|
||||||
type: 'fixedCollection',
|
|
||||||
typeOptions: {
|
|
||||||
multipleValues: true,
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'property',
|
|
||||||
displayName: 'Property',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
displayName: 'Property Name',
|
|
||||||
name: 'name',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Name of the property to set.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Property Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Value of the property to set.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2271,6 +2429,84 @@ export class Pipedrive implements INodeType {
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
|
// Get all the person labels to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getPersonLabels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const operation = this.getCurrentNodeParameter('operation') as string;
|
||||||
|
const { data } = await pipedriveApiRequest.call(this, 'GET', '/personFields', {});
|
||||||
|
for (const field of data) {
|
||||||
|
if (field.key === 'label') {
|
||||||
|
if (field.options) {
|
||||||
|
for (const option of field.options) {
|
||||||
|
returnData.push({
|
||||||
|
name: option.label,
|
||||||
|
value: option.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operation === 'update') {
|
||||||
|
returnData.push({
|
||||||
|
name: 'No Label',
|
||||||
|
value: 'null',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the labels to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getOrganizationLabels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const operation = this.getCurrentNodeParameter('operation') as string;
|
||||||
|
const { data } = await pipedriveApiRequest.call(this, 'GET', '/organizationFields', {});
|
||||||
|
for (const field of data) {
|
||||||
|
if (field.key === 'label') {
|
||||||
|
if (field.options) {
|
||||||
|
for (const option of field.options) {
|
||||||
|
returnData.push({
|
||||||
|
name: option.label,
|
||||||
|
value: option.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operation === 'update') {
|
||||||
|
returnData.push({
|
||||||
|
name: 'No Label',
|
||||||
|
value: 'null',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the labels to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getDealLabels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const operation = this.getCurrentNodeParameter('operation') as string;
|
||||||
|
const { data } = await pipedriveApiRequest.call(this, 'GET', '/dealFields', {});
|
||||||
|
for (const field of data) {
|
||||||
|
if (field.key === 'label') {
|
||||||
|
if (field.options) {
|
||||||
|
for (const option of field.options) {
|
||||||
|
returnData.push({
|
||||||
|
name: option.label,
|
||||||
|
value: option.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operation === 'update') {
|
||||||
|
returnData.push({
|
||||||
|
name: 'No Label',
|
||||||
|
value: 'null',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2455,8 +2691,10 @@ export class Pipedrive implements INodeType {
|
||||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
addAdditionalFields(body, updateFields);
|
addAdditionalFields(body, updateFields);
|
||||||
|
|
||||||
|
if (body.label === 'null') {
|
||||||
|
body.label = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (resource === 'file') {
|
} else if (resource === 'file') {
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -2633,6 +2871,24 @@ export class Pipedrive implements INodeType {
|
||||||
endpoint = `/organizations`;
|
endpoint = `/organizations`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (operation === 'update') {
|
||||||
|
// ----------------------------------
|
||||||
|
// organization:update
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
const id = this.getNodeParameter('organizationId', i) as string;
|
||||||
|
|
||||||
|
requestMethod = 'PUT';
|
||||||
|
endpoint = `/organizations/${id}`;
|
||||||
|
|
||||||
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
|
addAdditionalFields(body, updateFields);
|
||||||
|
|
||||||
|
if (body.label === 'null') {
|
||||||
|
body.label = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else if (resource === 'person') {
|
} else if (resource === 'person') {
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -2736,6 +2992,10 @@ export class Pipedrive implements INodeType {
|
||||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||||
addAdditionalFields(body, updateFields);
|
addAdditionalFields(body, updateFields);
|
||||||
|
|
||||||
|
if (body.label === 'null') {
|
||||||
|
body.label = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if (resource === 'product') {
|
} else if (resource === 'product') {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
|
|
Loading…
Reference in a new issue