mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
⚡ Sort options on Salesforce-Node
This commit is contained in:
parent
a77e96592f
commit
f3b92a8502
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -9,7 +9,8 @@ import {
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDataObject
|
IDataObject,
|
||||||
|
INodePropertyOptions,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
@ -52,3 +53,20 @@ export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILo
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts the given options alphabetically
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @param {INodePropertyOptions[]} options
|
||||||
|
* @returns {INodePropertyOptions[]}
|
||||||
|
*/
|
||||||
|
export function sortOptions(options: INodePropertyOptions[]): void {
|
||||||
|
options.sort((a, b) => {
|
||||||
|
if (a.name < b.name) { return -1; }
|
||||||
|
if (a.name > b.name) { return 1; }
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import {
|
||||||
import {
|
import {
|
||||||
salesforceApiRequest,
|
salesforceApiRequest,
|
||||||
salesforceApiRequestAllItems,
|
salesforceApiRequestAllItems,
|
||||||
|
sortOptions,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -229,6 +230,7 @@ export class Salesforce implements INodeType {
|
||||||
value: statusId,
|
value: statusId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the users to display them to user so that he can
|
// Get all the users to display them to user so that he can
|
||||||
|
@ -247,6 +249,7 @@ export class Salesforce implements INodeType {
|
||||||
value: userId,
|
value: userId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the lead sources to display them to user so that he can
|
// Get all the lead sources to display them to user so that he can
|
||||||
|
@ -274,6 +277,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the lead custom fields to display them to user so that he can
|
// Get all the lead custom fields to display them to user so that he can
|
||||||
|
@ -293,6 +297,7 @@ export class Salesforce implements INodeType {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the accounts to display them to user so that he can
|
// Get all the accounts to display them to user so that he can
|
||||||
|
@ -311,6 +316,7 @@ export class Salesforce implements INodeType {
|
||||||
value: accountId,
|
value: accountId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the campaigns to display them to user so that he can
|
// Get all the campaigns to display them to user so that he can
|
||||||
|
@ -329,6 +335,7 @@ export class Salesforce implements INodeType {
|
||||||
value: campaignId,
|
value: campaignId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the stages to display them to user so that he can
|
// Get all the stages to display them to user so that he can
|
||||||
|
@ -349,6 +356,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the stages to display them to user so that he can
|
// Get all the stages to display them to user so that he can
|
||||||
|
@ -369,6 +377,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the account sources to display them to user so that he can
|
// Get all the account sources to display them to user so that he can
|
||||||
|
@ -389,6 +398,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the case types to display them to user so that he can
|
// Get all the case types to display them to user so that he can
|
||||||
|
@ -409,6 +419,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the case statuses to display them to user so that he can
|
// Get all the case statuses to display them to user so that he can
|
||||||
|
@ -429,6 +440,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the case reasons to display them to user so that he can
|
// Get all the case reasons to display them to user so that he can
|
||||||
|
@ -449,6 +461,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the case origins to display them to user so that he can
|
// Get all the case origins to display them to user so that he can
|
||||||
|
@ -469,6 +482,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the case priorities to display them to user so that he can
|
// Get all the case priorities to display them to user so that he can
|
||||||
|
@ -489,6 +503,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task statuses to display them to user so that he can
|
// Get all the task statuses to display them to user so that he can
|
||||||
|
@ -509,6 +524,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task subjects to display them to user so that he can
|
// Get all the task subjects to display them to user so that he can
|
||||||
|
@ -529,6 +545,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task call types to display them to user so that he can
|
// Get all the task call types to display them to user so that he can
|
||||||
|
@ -549,6 +566,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task call priorities to display them to user so that he can
|
// Get all the task call priorities to display them to user so that he can
|
||||||
|
@ -569,6 +587,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task recurrence types to display them to user so that he can
|
// Get all the task recurrence types to display them to user so that he can
|
||||||
|
@ -589,6 +608,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the task recurrence instances to display them to user so that he can
|
// Get all the task recurrence instances to display them to user so that he can
|
||||||
|
@ -609,6 +629,7 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -628,6 +649,7 @@ export class Salesforce implements INodeType {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -646,6 +668,7 @@ export class Salesforce implements INodeType {
|
||||||
value: fieldId,
|
value: fieldId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue