first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,436 @@
|
||||
import flow from 'lodash/flow';
|
||||
import sortBy from 'lodash/sortBy';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type {
|
||||
AllFields,
|
||||
CamelCaseResource,
|
||||
DateType,
|
||||
GetAllFilterOptions,
|
||||
IdType,
|
||||
LoadedFields,
|
||||
LoadedLayouts,
|
||||
LocationType,
|
||||
NameType,
|
||||
ProductDetails,
|
||||
ResourceItems,
|
||||
SnakeCaseResource,
|
||||
ZohoOAuth2ApiCredentials,
|
||||
} from './types';
|
||||
|
||||
export function throwOnErrorStatus(
|
||||
this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
responseData: {
|
||||
data?: Array<{ status: string; message: string }>;
|
||||
},
|
||||
) {
|
||||
if (responseData?.data?.[0].status === 'error') {
|
||||
throw new NodeOperationError(this.getNode(), responseData as Error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function zohoApiRequest(
|
||||
this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
) {
|
||||
const { oauthTokenData } = await this.getCredentials<ZohoOAuth2ApiCredentials>('zohoOAuth2Api');
|
||||
|
||||
const options: IRequestOptions = {
|
||||
body: {
|
||||
data: [body],
|
||||
},
|
||||
method,
|
||||
qs,
|
||||
uri: uri || `${oauthTokenData.api_domain}/crm/v2${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (!Object.keys(qs).length) {
|
||||
delete options.qs;
|
||||
}
|
||||
|
||||
try {
|
||||
const responseData = await this.helpers.requestOAuth2?.call(this, 'zohoOAuth2Api', options);
|
||||
if (responseData === undefined) return [];
|
||||
throwOnErrorStatus.call(this, responseData as IDataObject);
|
||||
|
||||
return responseData;
|
||||
} catch (error) {
|
||||
const args = error.cause?.data
|
||||
? {
|
||||
message: error.cause.data.message || 'The Zoho API returned an error.',
|
||||
description: JSON.stringify(error.cause.data, null, 2),
|
||||
}
|
||||
: undefined;
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an authenticated API request to Zoho CRM API and return all items.
|
||||
*/
|
||||
export async function zohoApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
qs.per_page = 200;
|
||||
qs.page = 1;
|
||||
|
||||
do {
|
||||
responseData = await zohoApiRequest.call(this, method, endpoint, body, qs);
|
||||
if (Array.isArray(responseData) && !responseData.length) return returnData;
|
||||
returnData.push(...(responseData.data as IDataObject[]));
|
||||
qs.page++;
|
||||
} while (responseData.info.more_records !== undefined && responseData.info.more_records === true);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a Zoho CRM API listing by returning all items or up to a limit.
|
||||
*/
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
|
||||
if (returnAll) {
|
||||
return await zohoApiRequestAllItems.call(this, method, endpoint, body, qs);
|
||||
}
|
||||
|
||||
const responseData = await zohoApiRequestAllItems.call(this, method, endpoint, body, qs);
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
|
||||
return responseData.slice(0, limit);
|
||||
}
|
||||
|
||||
export function throwOnEmptyUpdate(this: IExecuteFunctions, resource: CamelCaseResource) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one field to update for the ${resource}.`,
|
||||
);
|
||||
}
|
||||
|
||||
export function throwOnMissingProducts(
|
||||
this: IExecuteFunctions,
|
||||
resource: CamelCaseResource,
|
||||
productDetails: ProductDetails,
|
||||
) {
|
||||
if (!productDetails.length) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`Please enter at least one product for the ${resource}.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// required field adjusters
|
||||
// ----------------------------------------
|
||||
|
||||
/**
|
||||
* Create a copy of an object without a specific property.
|
||||
*/
|
||||
const omit = (propertyToOmit: string, { [propertyToOmit]: _, ...remainingObject }) =>
|
||||
remainingObject;
|
||||
|
||||
/**
|
||||
* Place a product ID at a nested position in a product details field.
|
||||
*/
|
||||
export const adjustProductDetails = (productDetails: ProductDetails, operation?: string) => {
|
||||
return productDetails.map((p) => {
|
||||
const adjustedProduct = {
|
||||
product: { id: p.id },
|
||||
quantity: p.quantity || 1,
|
||||
};
|
||||
|
||||
if (operation === 'upsert') {
|
||||
return { ...adjustedProduct, ...omit('id', p) };
|
||||
} else {
|
||||
return { ...adjustedProduct, ...omit('product', p) };
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// additional field adjusters
|
||||
// ----------------------------------------
|
||||
|
||||
/**
|
||||
* Place a product ID at a nested position in a product details field.
|
||||
*
|
||||
* Only for updating products from Invoice, Purchase Order, Quote, and Sales Order.
|
||||
*/
|
||||
export const adjustProductDetailsOnUpdate = (allFields: AllFields) => {
|
||||
if (!allFields.Product_Details) return allFields;
|
||||
|
||||
return allFields.Product_Details.map((p) => {
|
||||
return {
|
||||
...omit('product', p),
|
||||
product: { id: p.id },
|
||||
quantity: p.quantity || 1,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Place a location field's contents at the top level of the payload.
|
||||
*/
|
||||
const adjustLocationFields = (locationType: LocationType) => (allFields: AllFields) => {
|
||||
const locationField = allFields[locationType];
|
||||
|
||||
if (!locationField) return allFields;
|
||||
|
||||
return {
|
||||
...omit(locationType, allFields),
|
||||
...locationField.address_fields,
|
||||
};
|
||||
};
|
||||
|
||||
const adjustAddressFields = adjustLocationFields('Address');
|
||||
const adjustBillingAddressFields = adjustLocationFields('Billing_Address');
|
||||
const adjustMailingAddressFields = adjustLocationFields('Mailing_Address');
|
||||
const adjustShippingAddressFields = adjustLocationFields('Shipping_Address');
|
||||
const adjustOtherAddressFields = adjustLocationFields('Other_Address');
|
||||
|
||||
/**
|
||||
* Remove from a date field the timestamp set by the datepicker.
|
||||
*/
|
||||
const adjustDateField = (dateType: DateType) => (allFields: AllFields) => {
|
||||
const dateField = allFields[dateType];
|
||||
|
||||
if (!dateField) return allFields;
|
||||
|
||||
allFields[dateType] = dateField.split('T')[0];
|
||||
|
||||
return allFields;
|
||||
};
|
||||
|
||||
const adjustDateOfBirthField = adjustDateField('Date_of_Birth');
|
||||
const adjustClosingDateField = adjustDateField('Closing_Date');
|
||||
const adjustInvoiceDateField = adjustDateField('Invoice_Date');
|
||||
const adjustDueDateField = adjustDateField('Due_Date');
|
||||
const adjustPurchaseOrderDateField = adjustDateField('PO_Date');
|
||||
const adjustValidTillField = adjustDateField('Valid_Till');
|
||||
|
||||
/**
|
||||
* Place an ID field's value nested inside the payload.
|
||||
*/
|
||||
const adjustIdField = (idType: IdType, nameProperty: NameType) => (allFields: AllFields) => {
|
||||
const idValue = allFields[idType];
|
||||
|
||||
if (!idValue) return allFields;
|
||||
|
||||
return {
|
||||
...omit(idType, allFields),
|
||||
[nameProperty]: { id: idValue },
|
||||
};
|
||||
};
|
||||
|
||||
const adjustAccountIdField = adjustIdField('accountId', 'Account_Name');
|
||||
const adjustContactIdField = adjustIdField('contactId', 'Full_Name');
|
||||
const adjustDealIdField = adjustIdField('dealId', 'Deal_Name');
|
||||
|
||||
const adjustCustomFields = (allFields: AllFields) => {
|
||||
const { customFields, ...rest } = allFields;
|
||||
|
||||
if (!customFields?.customFields.length) return allFields;
|
||||
|
||||
return customFields.customFields.reduce((acc, cur) => {
|
||||
acc[cur.fieldId] = cur.value;
|
||||
return acc;
|
||||
}, rest);
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// payload adjusters
|
||||
// ----------------------------------------
|
||||
|
||||
export const adjustAccountPayload = flow(
|
||||
adjustBillingAddressFields,
|
||||
adjustShippingAddressFields,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustContactPayload = flow(
|
||||
adjustMailingAddressFields,
|
||||
adjustOtherAddressFields,
|
||||
adjustDateOfBirthField,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustDealPayload = flow(adjustClosingDateField, adjustCustomFields);
|
||||
|
||||
export const adjustInvoicePayload = flow(
|
||||
adjustBillingAddressFields,
|
||||
adjustShippingAddressFields,
|
||||
adjustInvoiceDateField,
|
||||
adjustDueDateField,
|
||||
adjustAccountIdField,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustInvoicePayloadOnUpdate = flow(
|
||||
adjustInvoicePayload,
|
||||
adjustProductDetailsOnUpdate,
|
||||
);
|
||||
|
||||
export const adjustLeadPayload = flow(adjustAddressFields, adjustCustomFields);
|
||||
|
||||
export const adjustPurchaseOrderPayload = flow(
|
||||
adjustBillingAddressFields,
|
||||
adjustShippingAddressFields,
|
||||
adjustDueDateField,
|
||||
adjustPurchaseOrderDateField,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustQuotePayload = flow(
|
||||
adjustBillingAddressFields,
|
||||
adjustShippingAddressFields,
|
||||
adjustValidTillField,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustSalesOrderPayload = flow(
|
||||
adjustBillingAddressFields,
|
||||
adjustShippingAddressFields,
|
||||
adjustDueDateField,
|
||||
adjustAccountIdField,
|
||||
adjustContactIdField,
|
||||
adjustDealIdField,
|
||||
adjustCustomFields,
|
||||
);
|
||||
|
||||
export const adjustVendorPayload = flow(adjustAddressFields, adjustCustomFields);
|
||||
|
||||
export const adjustProductPayload = adjustCustomFields;
|
||||
|
||||
// ----------------------------------------
|
||||
// helpers
|
||||
// ----------------------------------------
|
||||
|
||||
/**
|
||||
* Convert items in a Zoho CRM API response into n8n load options.
|
||||
*/
|
||||
export const toLoadOptions = (items: ResourceItems, nameProperty: NameType) =>
|
||||
items.map((item) => ({ name: item[nameProperty], value: item.id }));
|
||||
|
||||
export function getModuleName(resource: string) {
|
||||
const map: { [key: string]: string } = {
|
||||
account: 'Accounts',
|
||||
contact: 'Contacts',
|
||||
deal: 'Deals',
|
||||
invoice: 'Invoices',
|
||||
lead: 'Leads',
|
||||
product: 'Products',
|
||||
purchaseOrder: 'Purchase_Orders',
|
||||
salesOrder: 'Sales_Orders',
|
||||
vendor: 'Vendors',
|
||||
quote: 'Quotes',
|
||||
};
|
||||
|
||||
return map[resource];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all fields for a resource, sorted alphabetically.
|
||||
*/
|
||||
export async function getFields(
|
||||
this: ILoadOptionsFunctions,
|
||||
resource: SnakeCaseResource,
|
||||
{ onlyCustom } = { onlyCustom: false },
|
||||
) {
|
||||
const qs = { module: getModuleName(resource) };
|
||||
|
||||
let { fields } = (await zohoApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/settings/fields',
|
||||
{},
|
||||
qs,
|
||||
)) as LoadedFields;
|
||||
|
||||
if (onlyCustom) {
|
||||
fields = fields.filter(({ custom_field }) => custom_field);
|
||||
}
|
||||
|
||||
const options = fields.map(({ field_label, api_name }) => ({
|
||||
name: field_label,
|
||||
value: api_name,
|
||||
}));
|
||||
|
||||
return sortBy(options, (o) => o.name);
|
||||
}
|
||||
|
||||
export const capitalizeInitial = (str: string) => str[0].toUpperCase() + str.slice(1);
|
||||
|
||||
function getSectionApiName(resource: string) {
|
||||
if (resource === 'purchaseOrder') return 'Purchase Order Information';
|
||||
if (resource === 'salesOrder') return 'Sales Order Information';
|
||||
|
||||
return `${capitalizeInitial(resource)} Information`;
|
||||
}
|
||||
|
||||
export async function getPicklistOptions(
|
||||
this: ILoadOptionsFunctions,
|
||||
resource: string,
|
||||
targetField: string,
|
||||
) {
|
||||
const qs = { module: getModuleName(resource) };
|
||||
const responseData = (await zohoApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/settings/layouts',
|
||||
{},
|
||||
qs,
|
||||
)) as LoadedLayouts;
|
||||
|
||||
const pickListOptions = responseData.layouts[0].sections
|
||||
.find((section) => section.api_name === getSectionApiName(resource))
|
||||
?.fields.find((f) => f.api_name === targetField)?.pick_list_values;
|
||||
|
||||
if (!pickListOptions) return [];
|
||||
|
||||
return pickListOptions.map((option) => ({
|
||||
name: option.display_value,
|
||||
value: option.actual_value,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add filter options to a query string object.
|
||||
*/
|
||||
export const addGetAllFilterOptions = (qs: IDataObject, options: GetAllFilterOptions) => {
|
||||
if (Object.keys(options).length) {
|
||||
const { fields, ...rest } = options;
|
||||
Object.assign(qs, fields && { fields: fields.join(',') }, rest);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.zohoCrm",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Communication", "Sales"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/zoho/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.zohocrm/"
|
||||
}
|
||||
],
|
||||
"generic": [
|
||||
{
|
||||
"label": "6 e-commerce workflows to power up your Shopify s",
|
||||
"icon": "store",
|
||||
"url": "https://n8n.io/blog/no-code-ecommerce-workflow-automations/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$is_duplicate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$layout_id": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"Account_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Account_Number": {
|
||||
"type": "string"
|
||||
},
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Parent_Account": {
|
||||
"type": "null"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Account_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Account_Number": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$is_duplicate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$layout_id": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Email_Opt_Out": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Fax": {
|
||||
"type": "null"
|
||||
},
|
||||
"Full_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Home_Phone": {
|
||||
"type": "null"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Last_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Other_City": {
|
||||
"type": "null"
|
||||
},
|
||||
"Other_Country": {
|
||||
"type": "null"
|
||||
},
|
||||
"Other_State": {
|
||||
"type": "null"
|
||||
},
|
||||
"Other_Street": {
|
||||
"type": "null"
|
||||
},
|
||||
"Other_Zip": {
|
||||
"type": "null"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Reporting_To": {
|
||||
"type": "null"
|
||||
},
|
||||
"Tag": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Unsubscribed_Mode": {
|
||||
"type": "null"
|
||||
},
|
||||
"Unsubscribed_Time": {
|
||||
"type": "null"
|
||||
},
|
||||
"Vendor_Name": {
|
||||
"type": "null"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$is_duplicate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$layout_id": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_label": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"Account_Name": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Email_Opt_Out": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Full_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Last_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tag": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Unsubscribed_Mode": {
|
||||
"type": "null"
|
||||
},
|
||||
"Unsubscribed_Time": {
|
||||
"type": "null"
|
||||
}
|
||||
},
|
||||
"version": 8
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$canvas_id": {
|
||||
"type": "null"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"Account_Name": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Contact_Name": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Deal_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Probability": {
|
||||
"type": "integer"
|
||||
},
|
||||
"Tag": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Deal_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$converted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$zia_owner_assignment": {
|
||||
"type": "string"
|
||||
},
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Email_Opt_Out": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Fax": {
|
||||
"type": "null"
|
||||
},
|
||||
"Full_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Last_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"No_of_Employees": {
|
||||
"type": "null"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Rating": {
|
||||
"type": "null"
|
||||
},
|
||||
"Secondary_Email": {
|
||||
"type": "null"
|
||||
},
|
||||
"Tag": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Unsubscribed_Mode": {
|
||||
"type": "null"
|
||||
},
|
||||
"Unsubscribed_Time": {
|
||||
"type": "null"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$approval": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"delegate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"takeover": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$approval_state": {
|
||||
"type": "string"
|
||||
},
|
||||
"$approved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$converted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"$editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$field_states": {
|
||||
"type": "null"
|
||||
},
|
||||
"$in_merge": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$layout_id": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_label": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$locked_for_me": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$process_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"$review": {
|
||||
"type": "null"
|
||||
},
|
||||
"$review_process": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"approve": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reject": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"resubmit": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$state": {
|
||||
"type": "string"
|
||||
},
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Email_Opt_Out": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Full_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Last_Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"Locked__s": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"Owner": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tag": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"association_details": {
|
||||
"type": "null"
|
||||
},
|
||||
"businesscard_supported": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"convert_mapping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Deals": {
|
||||
"type": "null"
|
||||
}
|
||||
}
|
||||
},
|
||||
"created_source": {
|
||||
"type": "string"
|
||||
},
|
||||
"crypt": {
|
||||
"type": "null"
|
||||
},
|
||||
"custom_field": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"data_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"decimal_place": {
|
||||
"type": "null"
|
||||
},
|
||||
"display_label": {
|
||||
"type": "string"
|
||||
},
|
||||
"external": {
|
||||
"type": "null"
|
||||
},
|
||||
"field_label": {
|
||||
"type": "string"
|
||||
},
|
||||
"field_read_only": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"history_tracking": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"json_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mass_update": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"pick_list_values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"actual_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"reference_value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"quick_sequence_number": {
|
||||
"type": "string"
|
||||
},
|
||||
"read_only": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subform": {
|
||||
"type": "null"
|
||||
},
|
||||
"system_mandatory": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"ui_type": {
|
||||
"type": "integer"
|
||||
},
|
||||
"view_type": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"create": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"edit": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"quick_create": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"view": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"visible": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"webhook": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Created_Time": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"Modified_By": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Modified_Time": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
billingAddress,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
shippingAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const accountOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an account',
|
||||
action: 'Create an account',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or Update an account',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an account',
|
||||
action: 'Delete an account',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an account',
|
||||
action: 'Get an account',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many accounts',
|
||||
action: 'Get many accounts',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an account',
|
||||
action: 'Update an account',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const accountFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// account: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account Name',
|
||||
name: 'accountName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// account: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account Name',
|
||||
name: 'accountName',
|
||||
description:
|
||||
'Name of the account. If a record with this account name exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// account: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Number',
|
||||
name: 'Account_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Site',
|
||||
name: 'Account_Site',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the account’s location, e.g. Headquarters or London',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Type Name or ID',
|
||||
name: 'Account_Type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccountType',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
name: 'Annual_Revenue',
|
||||
type: 'number',
|
||||
default: '',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Contact Details',
|
||||
name: 'Contact_Details',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('account'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Employees',
|
||||
name: 'Employees',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Number of employees in the account’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'Industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Ticker Symbol',
|
||||
name: 'Ticker_Symbol',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// account: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
description: 'ID of the account to delete. Can be found at the end of the URL.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// account: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
description: 'ID of the account to retrieve. Can be found at the end of the URL.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// account: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('account'),
|
||||
|
||||
// ----------------------------------------
|
||||
// account: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
description: 'ID of the account to update. Can be found at the end of the URL.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['account'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Name',
|
||||
name: 'Account_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Number',
|
||||
name: 'Account_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Site',
|
||||
name: 'Account_Site',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the account’s location, e.g. Headquarters or London',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Type Name or ID',
|
||||
name: 'Account_Type',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccountType',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
name: 'Annual_Revenue',
|
||||
type: 'number',
|
||||
default: '',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Contact Details',
|
||||
name: 'Contact_Details',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('account'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Employees',
|
||||
name: 'Employees',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Number of employees in the account’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'Industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Ticker Symbol',
|
||||
name: 'Ticker_Symbol',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,561 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
currencies,
|
||||
mailingAddress,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
otherAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const contactOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a contact',
|
||||
action: 'Create a contact',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or Update a contact',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a contact',
|
||||
action: 'Delete a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a contact',
|
||||
action: 'Get a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many contacts',
|
||||
action: 'Get many contacts',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a contact',
|
||||
action: 'Update a contact',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const contactFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// contact: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assistant',
|
||||
name: 'Assistant',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the contact’s assistant',
|
||||
},
|
||||
makeCustomFieldsFixedCollection('contact'),
|
||||
{
|
||||
displayName: 'Date of Birth',
|
||||
name: 'Date_of_Birth',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Department',
|
||||
name: 'Department',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Company department to which the contact belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Primary)',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Secondary)',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
mailingAddress,
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
otherAddress,
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Assistant)',
|
||||
name: 'Asst_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact’s assistant',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Home)',
|
||||
name: 'Home_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Other)',
|
||||
name: 'Other_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'Title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the contact at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// contact: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assistant',
|
||||
name: 'Assistant',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the contact’s assistant',
|
||||
},
|
||||
makeCustomFieldsFixedCollection('contact'),
|
||||
{
|
||||
displayName: 'Date of Birth',
|
||||
name: 'Date_of_Birth',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Department',
|
||||
name: 'Department',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Company department to which the contact belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Primary)',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'Email of the contact. If a record with this email exists it will be updated, otherwise a new one will be created.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Secondary)',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
mailingAddress,
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
otherAddress,
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Assistant)',
|
||||
name: 'Asst_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact’s assistant',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Home)',
|
||||
name: 'Home_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone (Other)',
|
||||
name: 'Other_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'Title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the contact at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// contact: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
description: 'ID of the contact to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// contact: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
description: 'ID of the contact to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// contact: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('contact'),
|
||||
|
||||
// ----------------------------------------
|
||||
// contact: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
description: 'ID of the contact to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['contact'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assistant',
|
||||
name: 'Assistant',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Assistant’s Phone',
|
||||
name: 'Asst_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact’s assistant',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('contact'),
|
||||
{
|
||||
displayName: 'Date of Birth',
|
||||
name: 'Date_of_Birth',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Department',
|
||||
name: 'Department',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Primary)',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email (Secondary)',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Home Phone',
|
||||
name: 'Home_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'Last_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
mailingAddress,
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
otherAddress,
|
||||
{
|
||||
displayName: 'Other Phone',
|
||||
name: 'Other_Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'Title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the contact at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,354 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { currencies, makeCustomFieldsFixedCollection, makeGetAllFields } from './SharedFields';
|
||||
|
||||
export const dealOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a deal',
|
||||
action: 'Create a deal',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or Update a deal',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a contact',
|
||||
action: 'Delete a deal',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a contact',
|
||||
action: 'Get a deal',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many contacts',
|
||||
action: 'Get many deals',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a contact',
|
||||
action: 'Update a deal',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const dealFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// deal: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Deal Name',
|
||||
name: 'dealName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// deal: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Deal Name',
|
||||
name: 'dealName',
|
||||
description:
|
||||
'Name of the deal. If a record with this deal name exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
// ----------------------------------------
|
||||
// deal: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Stage Name or ID',
|
||||
name: 'stage',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
required: true,
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealStage',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Monetary amount of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Closing Date',
|
||||
name: 'Closing_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('deal'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Conversion Time',
|
||||
name: 'Lead_Conversion_Time',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Average number of days to convert the lead into a deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Next Step',
|
||||
name: 'Next_Step',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Description of the next step in the sales process',
|
||||
},
|
||||
{
|
||||
displayName: 'Overall Sales Duration',
|
||||
name: 'Overall_Sales_Duration',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Average number of days to convert the lead into a deal and to win the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Probability',
|
||||
name: 'Probability',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: '',
|
||||
description: 'Probability of deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Cycle Duration',
|
||||
name: 'Sales_Cycle_Duration',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'Average number of days for the deal to be won',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// deal: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
description: 'ID of the deal to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// deal: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
description: 'ID of the deal to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// deal: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('deal'),
|
||||
|
||||
// ----------------------------------------
|
||||
// deal: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
description: 'ID of the deal to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['deal'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Amount',
|
||||
name: 'Amount',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Monetary amount of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Closing Date',
|
||||
name: 'Closing_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
},
|
||||
makeCustomFieldsFixedCollection('deal'),
|
||||
{
|
||||
displayName: 'Deal Name',
|
||||
name: 'Deal_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Conversion Time',
|
||||
name: 'Lead_Conversion_Time',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Average number of days to convert the lead into a deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Next Step',
|
||||
name: 'Next_Step',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Description of the next step in the sales process',
|
||||
},
|
||||
{
|
||||
displayName: 'Overall Sales Duration',
|
||||
name: 'Overall_Sales_Duration',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Average number of days to convert the lead into a deal and to win the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Probability',
|
||||
name: 'Probability',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: '',
|
||||
description: 'Probability of deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Cycle Duration',
|
||||
name: 'Sales_Cycle_Duration',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'Average number of days to win the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Stage Name or ID',
|
||||
name: 'Stage',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealStage',
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,436 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
billingAddress,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
productDetailsOptions,
|
||||
shippingAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const invoiceOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an invoice',
|
||||
action: 'Create an invoice',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or Update an invoice',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an invoice',
|
||||
action: 'Delete an invoice',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an invoice',
|
||||
action: 'Get an invoice',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many invoices',
|
||||
action: 'Get many invoices',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an invoice',
|
||||
action: 'Update an invoice',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const invoiceFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// invoice: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'Subject or title of the invoice',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description:
|
||||
'Subject or title of the invoice. If a record with this subject exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'Product_Details',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Product',
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: productDetailsOptions,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Name or ID',
|
||||
name: 'accountId',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccounts',
|
||||
},
|
||||
description:
|
||||
'ID of the account associated with this invoice. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('invoice'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Invoice Date',
|
||||
name: 'Invoice_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Invoice Number',
|
||||
name: 'Invoice_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'Status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the invoice',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Invoice ID',
|
||||
name: 'invoiceId',
|
||||
description: 'ID of the invoice to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Invoice ID',
|
||||
name: 'invoiceId',
|
||||
description: 'ID of the invoice to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('invoice'),
|
||||
|
||||
// ----------------------------------------
|
||||
// invoice: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Invoice ID',
|
||||
name: 'invoiceId',
|
||||
description: 'ID of the invoice to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invoice'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Name or ID',
|
||||
name: 'accountId',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccounts',
|
||||
},
|
||||
description:
|
||||
'ID of the account associated with this invoice. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('invoice'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Invoice Date',
|
||||
name: 'Invoice_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Invoice Number',
|
||||
name: 'Invoice_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'Product_Details',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Product',
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: productDetailsOptions,
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'Status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'Subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Subject or title of the invoice',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the invoice',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,658 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
address,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
} from './SharedFields';
|
||||
|
||||
export const leadOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a lead',
|
||||
action: 'Create a lead',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a lead',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a lead',
|
||||
action: 'Delete a lead',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a lead',
|
||||
action: 'Get a lead',
|
||||
},
|
||||
{
|
||||
name: 'Get Fields',
|
||||
value: 'getFields',
|
||||
description: 'Get lead fields',
|
||||
action: 'Get lead fields',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many leads',
|
||||
action: 'Get many leads',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a lead',
|
||||
action: 'Update a lead',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const leadFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// lead: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'Company',
|
||||
description: 'Company at which the lead works',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
address,
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
name: 'Annual_Revenue',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Annual revenue of the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('lead'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Designation',
|
||||
name: 'Designation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the lead at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email Opt Out',
|
||||
name: 'Email_Opt_Out',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'Industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry Type',
|
||||
name: 'Industry_Type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Type of industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Source',
|
||||
name: 'Lead_Source',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which the lead was created',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Status',
|
||||
name: 'Lead_Status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Number of Employees',
|
||||
name: 'No_of_Employees',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Number of employees in the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Secondary Email',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'Company',
|
||||
description: 'Company at which the lead works',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
address,
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
name: 'Annual_Revenue',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Annual revenue of the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('lead'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Designation',
|
||||
name: 'Designation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the lead at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description:
|
||||
'Email of the lead. If a record with this email exists it will be updated, otherwise a new one will be created.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email Opt Out',
|
||||
name: 'Email_Opt_Out',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'Industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry Type',
|
||||
name: 'Industry_Type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Type of industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Source',
|
||||
name: 'Lead_Source',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which the lead was created',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Status',
|
||||
name: 'Lead_Status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Number of Employees',
|
||||
name: 'No_of_Employees',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Number of employees in the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Secondary Email',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
description: 'ID of the lead to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
description: 'ID of the lead to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('lead'),
|
||||
|
||||
// ----------------------------------------
|
||||
// lead: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
description: 'ID of the lead to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['lead'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
address,
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
name: 'Annual_Revenue',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Annual revenue of the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'Company',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Company at which the lead works',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('lead'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Designation',
|
||||
name: 'Designation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Position of the lead at their company',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email Opt Out',
|
||||
name: 'Email_Opt_Out',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Fax',
|
||||
name: 'Fax',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'First_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Full Name',
|
||||
name: 'Full_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'Industry',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry Type',
|
||||
name: 'Industry_Type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Type of industry to which the lead belongs',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'Last_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Source',
|
||||
name: 'Lead_Source',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which the lead was created',
|
||||
},
|
||||
{
|
||||
displayName: 'Lead Status',
|
||||
name: 'Lead_Status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Mobile',
|
||||
name: 'Mobile',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Number of Employees',
|
||||
name: 'No_of_Employees',
|
||||
type: 'number',
|
||||
default: '',
|
||||
description: 'Number of employees in the lead’s company',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Salutation',
|
||||
name: 'Salutation',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Secondary Email',
|
||||
name: 'Secondary_Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Skype ID',
|
||||
name: 'Skype_ID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Twitter',
|
||||
name: 'Twitter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,323 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { makeCustomFieldsFixedCollection, makeGetAllFields } from './SharedFields';
|
||||
|
||||
export const productOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a product',
|
||||
action: 'Create a product',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a product',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a product',
|
||||
action: 'Delete a product',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a product',
|
||||
action: 'Get a product',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many products',
|
||||
action: 'Get many products',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a product',
|
||||
action: 'Update a product',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const productFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// product: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Product Name',
|
||||
name: 'productName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// product: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Product Name',
|
||||
name: 'productName',
|
||||
description:
|
||||
'Name of the product. If a record with this product name exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// product: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Commission Rate',
|
||||
name: 'Commission_Rate',
|
||||
type: 'number',
|
||||
description: 'Commission rate for the product. For example, enter 12 for 12%.',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('product'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Manufacturer',
|
||||
name: 'Manufacturer',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Active',
|
||||
name: 'Product_Active',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Product Category',
|
||||
name: 'Product_Category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity in Demand',
|
||||
name: 'Qty_in_Demand',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity in Stock',
|
||||
name: 'Qty_in_Stock',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Taxable',
|
||||
name: 'Taxable',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Unit Price',
|
||||
name: 'Unit_Price',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// product: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Product ID',
|
||||
name: 'productId',
|
||||
description: 'ID of the product to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// product: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Product ID',
|
||||
name: 'productId',
|
||||
description: 'ID of the product to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// product: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('product'),
|
||||
|
||||
// ----------------------------------------
|
||||
// product: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Product ID',
|
||||
name: 'productId',
|
||||
description: 'ID of the product to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['product'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Commission Rate',
|
||||
name: 'Commission_Rate',
|
||||
type: 'number',
|
||||
description: 'Commission rate for the product. For example, enter 12 for 12%.',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('product'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Manufacturer',
|
||||
name: 'Manufacturer',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Active',
|
||||
name: 'Product_Active',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Product Category',
|
||||
name: 'Product_Category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity in Demand',
|
||||
name: 'Qty_in_Demand',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity in Stock',
|
||||
name: 'Qty_in_Stock',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Taxable',
|
||||
name: 'Taxable',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Unit Price',
|
||||
name: 'Unit_Price',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,559 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
billingAddress,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
productDetailsOptions,
|
||||
shippingAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const purchaseOrderOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a purchase order',
|
||||
action: 'Create a purchase order',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a purchase order',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a purchase order',
|
||||
action: 'Delete a purchase order',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a purchase order',
|
||||
action: 'Get a purchase order',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many purchase orders',
|
||||
action: 'Get many purchase orders',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a purchase order',
|
||||
action: 'Update a purchase order',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const purchaseOrderFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'Subject or title of the purchase order',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description:
|
||||
'Subject or title of the purchase order. If a record with this subject exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor Name or ID',
|
||||
name: 'vendorId',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getVendors',
|
||||
},
|
||||
description:
|
||||
'ID of the vendor associated with the purchase order. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'Product_Details',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Product',
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: productDetailsOptions,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
{
|
||||
displayName: 'Billing Address',
|
||||
name: 'Billing_Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Billing Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Billing Address Fields',
|
||||
name: 'billing_address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Billing City',
|
||||
name: 'Billing_City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Billing Code',
|
||||
name: 'Billing_Code',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Billing Country',
|
||||
name: 'Billing_Country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Billing State',
|
||||
name: 'Billing_State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Billing Street',
|
||||
name: 'Billing_Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the carrier',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('purchaseOrder'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount',
|
||||
name: 'Discount',
|
||||
type: 'number',
|
||||
description: 'Discount applied to the purchase order. For example, enter 12 for 12%.',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'PO Date',
|
||||
name: 'PO_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date on which the purchase order was issued',
|
||||
},
|
||||
{
|
||||
displayName: 'PO Number',
|
||||
name: 'PO_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the purchase order after creating a case',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'Status',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getPurchaseOrderStatus',
|
||||
},
|
||||
description:
|
||||
'Status of the purchase order. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the purchase order',
|
||||
},
|
||||
{
|
||||
displayName: 'Tracking Number',
|
||||
name: 'Tracking_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Purchase Order ID',
|
||||
name: 'purchaseOrderId',
|
||||
description: 'ID of the purchase order to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Purchase Order ID',
|
||||
name: 'purchaseOrderId',
|
||||
description: 'ID of the purchase order to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('purchaseOrder'),
|
||||
|
||||
// ----------------------------------------
|
||||
// purchaseOrder: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Purchase Order ID',
|
||||
name: 'purchaseOrderId',
|
||||
description: 'ID of the purchase order to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['purchaseOrder'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the carrier',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('purchaseOrder'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount',
|
||||
name: 'Discount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'PO Date',
|
||||
name: 'PO_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date on which the purchase order was issued',
|
||||
},
|
||||
{
|
||||
displayName: 'PO Number',
|
||||
name: 'PO_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the purchase order after creating a case',
|
||||
},
|
||||
// productDetails('purchaseOrder', 'update'),
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'Status',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getPurchaseOrderStatus',
|
||||
},
|
||||
description:
|
||||
'Status of the purchase order. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'Subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Subject or title of the purchase order',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the purchase order',
|
||||
},
|
||||
{
|
||||
displayName: 'Tracking Number',
|
||||
name: 'Tracking_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,430 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
billingAddress,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
productDetailsOptions,
|
||||
shippingAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const quoteOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a quote',
|
||||
action: 'Create a quote',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a quote',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a quote',
|
||||
action: 'Delete a quote',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a quote',
|
||||
action: 'Get a quote',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many quotes',
|
||||
action: 'Get many quotes',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a quote',
|
||||
action: 'Update a quote',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const quoteFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// quote: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'Subject or title of the quote',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description:
|
||||
'Subject or title of the quote. If a record with this subject exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'Product_Details',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Product',
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: productDetailsOptions,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('quote'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Quote Stage Name or ID',
|
||||
name: 'Quote_Stage',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getQuoteStage',
|
||||
},
|
||||
description:
|
||||
'Stage of the quote. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Team',
|
||||
name: 'Team',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Team for whom the quote is created',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the quote',
|
||||
},
|
||||
{
|
||||
displayName: 'Valid Till',
|
||||
name: 'Valid_Till',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date until when the quote is valid',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Quote ID',
|
||||
name: 'quoteId',
|
||||
description: 'ID of the quote to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Quote ID',
|
||||
name: 'quoteId',
|
||||
description: 'ID of the quote to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('quote'),
|
||||
|
||||
// ----------------------------------------
|
||||
// quote: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Quote ID',
|
||||
name: 'quoteId',
|
||||
description: 'ID of the quote to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['quote'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('quote'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Quote Stage Name or ID',
|
||||
name: 'Quote_Stage',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getQuoteStage',
|
||||
},
|
||||
description:
|
||||
'Stage of the quote. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'Subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Subject or title of the quote',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Team',
|
||||
name: 'Team',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Team for whom the quote is created',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the quote',
|
||||
},
|
||||
{
|
||||
displayName: 'Valid Till',
|
||||
name: 'Valid_Till',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Date until when the quote is valid',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,548 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
billingAddress,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
productDetailsOptions,
|
||||
shippingAddress,
|
||||
} from './SharedFields';
|
||||
|
||||
export const salesOrderOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a sales order',
|
||||
action: 'Create a sales order',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a sales order',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a sales order',
|
||||
action: 'Delete a sales order',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a sales order',
|
||||
action: 'Get a sales order',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many sales orders',
|
||||
action: 'Get many sales orders',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a sales order',
|
||||
action: 'Update a sales order',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const salesOrderFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// salesOrder: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Account Name or ID',
|
||||
name: 'accountId',
|
||||
required: true,
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccounts',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description: 'Subject or title of the sales order',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
description:
|
||||
'Subject or title of the sales order. If a record with this subject exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'Product_Details',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Product',
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: productDetailsOptions,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the carrier',
|
||||
},
|
||||
{
|
||||
displayName: 'Contact Name or ID',
|
||||
name: 'contactId',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getContacts',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('salesOrder'),
|
||||
{
|
||||
displayName: 'Deal Name or ID',
|
||||
name: 'dealId',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDeals',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount',
|
||||
name: 'Discount',
|
||||
type: 'number',
|
||||
description: 'Discount applied to the sales order. For example, enter 12 for 12%.',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Order Number',
|
||||
name: 'SO_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the sales order after creating a case',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'Status',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSalesOrderStatus',
|
||||
},
|
||||
description:
|
||||
'Status of the sales order. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the purchase order',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Sales Order ID',
|
||||
name: 'salesOrderId',
|
||||
description: 'ID of the sales order to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Sales Order ID',
|
||||
name: 'salesOrderId',
|
||||
description: 'ID of the sales order to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('salesOrder'),
|
||||
|
||||
// ----------------------------------------
|
||||
// salesOrder: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Sales Order ID',
|
||||
name: 'salesOrderId',
|
||||
description: 'ID of the sales order to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['salesOrder'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Name or ID',
|
||||
name: 'accountId',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAccounts',
|
||||
},
|
||||
description:
|
||||
'ID of the account associated with this invoice. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Adjustment',
|
||||
name: 'Adjustment',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Adjustment in the grand total, if any',
|
||||
},
|
||||
billingAddress,
|
||||
{
|
||||
displayName: 'Carrier',
|
||||
name: 'Carrier',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the carrier',
|
||||
},
|
||||
{
|
||||
displayName: 'Contact Name or ID',
|
||||
name: 'contactId',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getContacts',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
description: 'Symbol of the currency in which revenue is generated',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('salesOrder'),
|
||||
{
|
||||
displayName: 'Deal Name or ID',
|
||||
name: 'dealId',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDeals',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount',
|
||||
name: 'Discount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'Due_Date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Exchange Rate',
|
||||
name: 'Exchange_Rate',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Exchange rate of the default currency to the home currency',
|
||||
},
|
||||
{
|
||||
displayName: 'Grand Total',
|
||||
name: 'Grand_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product after deducting tax and discounts',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Order Number',
|
||||
name: 'SO_Number',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the sales order after creating a case',
|
||||
},
|
||||
{
|
||||
displayName: 'Sales Commission',
|
||||
name: 'Sales_Commission',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description:
|
||||
'Commission of sales person on deal closure as a percentage. For example, enter 12 for 12%.',
|
||||
},
|
||||
shippingAddress,
|
||||
{
|
||||
displayName: 'Status Name or ID',
|
||||
name: 'Status',
|
||||
type: 'options',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getSalesOrderStatus',
|
||||
},
|
||||
description:
|
||||
'Status of the sales order. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Sub Total',
|
||||
name: 'Sub_Total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Total amount for the product excluding tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'Subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Subject or title of the sales order',
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
description: 'Tax amount as the sum of sales tax and value-added tax',
|
||||
},
|
||||
{
|
||||
displayName: 'Terms and Conditions',
|
||||
name: 'Terms_and_Conditions',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Terms and conditions associated with the purchase order',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,567 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { capitalizeInitial } from '../GenericFunctions';
|
||||
import type { CamelCaseResource } from '../types';
|
||||
|
||||
export const billingAddress: INodeProperties = {
|
||||
displayName: 'Billing Address',
|
||||
name: 'Billing_Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Billing Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Billing Address Fields',
|
||||
name: 'address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Street',
|
||||
name: 'Billing_Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'Billing_City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'Billing_State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'Billing_Country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'Billing_Code',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const shippingAddress: INodeProperties = {
|
||||
displayName: 'Shipping Address',
|
||||
name: 'Shipping_Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Shipping Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Shipping Address Fields',
|
||||
name: 'address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Street',
|
||||
name: 'Shipping_Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'Shipping_City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'Shipping_State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'Shipping_Country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'Shipping_Code',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const mailingAddress: INodeProperties = {
|
||||
displayName: 'Mailing Address',
|
||||
name: 'Mailing_Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Mailing Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Mailing Address Fields',
|
||||
name: 'address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Street',
|
||||
name: 'Mailing_Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'Mailing_City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'Mailing_State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'Mailing_Country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'Mailing_Zip',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const otherAddress: INodeProperties = {
|
||||
displayName: 'Other Address',
|
||||
name: 'Other_Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Other Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Other Address Fields',
|
||||
name: 'address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Street',
|
||||
name: 'Other_Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'Other_City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'Other_State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'Other_Zip',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const address: INodeProperties = {
|
||||
displayName: 'Address',
|
||||
name: 'Address',
|
||||
type: 'fixedCollection',
|
||||
default: {},
|
||||
placeholder: 'Add Address Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Address Fields',
|
||||
name: 'address_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Street',
|
||||
name: 'Street',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'City',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'State',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'Country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'Zip_Code',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// displayName: 'Products',
|
||||
// name: 'Product_Details',
|
||||
// type: 'collection',
|
||||
// typeOptions: {
|
||||
// multipleValues: true,
|
||||
// multipleValueButtonText: 'Add Product',
|
||||
// },
|
||||
// default: {},
|
||||
// placeholder: 'Add Field',
|
||||
// displayOptions: {
|
||||
// show: {
|
||||
// resource: [
|
||||
// resource,
|
||||
// ],
|
||||
// operation: [
|
||||
// operation,
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
|
||||
export const productDetailsOptions: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'List Price',
|
||||
name: 'list_price',
|
||||
type: 'number',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Name or ID',
|
||||
name: 'id',
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProducts',
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Product Description',
|
||||
name: 'product_description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity',
|
||||
name: 'quantity',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
},
|
||||
{
|
||||
displayName: 'Quantity in Stock',
|
||||
name: 'quantity_in_stock',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Tax',
|
||||
name: 'Tax',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Total',
|
||||
name: 'total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Total After Discount',
|
||||
name: 'total_after_discount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Total (Net)',
|
||||
name: 'net_total',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Unit Price',
|
||||
name: 'unit_price',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
];
|
||||
|
||||
export const makeGetAllFields = (resource: CamelCaseResource): INodeProperties[] => {
|
||||
const loadOptionsMethod = `get${capitalizeInitial(resource)}Fields`;
|
||||
|
||||
return [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [resource],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 5,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 1000,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [resource],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [resource],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Approved',
|
||||
name: 'approved',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether to retrieve only approved records. Defaults to true.',
|
||||
},
|
||||
{
|
||||
displayName: 'Converted',
|
||||
name: 'converted',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to retrieve only converted records. Defaults to false.',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
name: 'fields',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod,
|
||||
},
|
||||
default: [],
|
||||
description: 'Return only these fields',
|
||||
},
|
||||
{
|
||||
displayName: 'Include Child',
|
||||
name: 'include_child',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to retrieve only records from child territories',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort By',
|
||||
name: 'sort_by',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod,
|
||||
},
|
||||
default: [],
|
||||
description: 'Field to sort records by',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort Order',
|
||||
name: 'sort_order',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Ascending',
|
||||
value: 'asc',
|
||||
},
|
||||
{
|
||||
name: 'Descending',
|
||||
value: 'desc',
|
||||
},
|
||||
],
|
||||
default: 'desc',
|
||||
description: 'Ascending or descending order sort order',
|
||||
},
|
||||
{
|
||||
displayName: 'Territory ID',
|
||||
name: 'territory_id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Retrieve only records from this territory',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const makeCustomFieldsFixedCollection = (resource: CamelCaseResource): INodeProperties => {
|
||||
const loadOptionsMethod = `getCustom${capitalizeInitial(resource)}Fields`;
|
||||
|
||||
return {
|
||||
displayName: 'Custom Fields',
|
||||
name: 'customFields',
|
||||
placeholder: 'Add Custom Field',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
description: 'Filter by custom fields',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'customFields',
|
||||
displayName: 'Custom Field',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Field ID',
|
||||
name: 'fieldId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod,
|
||||
},
|
||||
default: '',
|
||||
description: 'Custom field to set a value to',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to set on custom field',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
// https://www.zoho.com/subscriptions/help/supported-currencies.html
|
||||
|
||||
export const currencies = [
|
||||
{ name: 'US Dollar', value: 'USD' },
|
||||
{ name: 'Euro', value: 'EUR' },
|
||||
{ name: 'UAE Dirham', value: 'AED' },
|
||||
{ name: 'Afghani', value: 'AFN' },
|
||||
{ name: 'Lek', value: 'ALL' },
|
||||
{ name: 'Argentine Peso', value: 'ARS' },
|
||||
{ name: 'Australian Dollar', value: 'AUD' },
|
||||
{ name: 'Azerbaijan Manat', value: 'AZN' },
|
||||
{ name: 'Barbados Dollar', value: 'BBD' },
|
||||
{ name: 'Taka', value: 'BDT' },
|
||||
{ name: 'Bulgarian Lev', value: 'BGN' },
|
||||
{ name: 'Bermudian Dollar', value: 'BMD' },
|
||||
{ name: 'Brunei Dollar', value: 'BND' },
|
||||
{ name: 'Boliviano', value: 'BOB' },
|
||||
{ name: 'Brazilian Real', value: 'BRL' },
|
||||
{ name: 'Bahamian Dollar', value: 'BSD' },
|
||||
{ name: 'Pula', value: 'BWP' },
|
||||
{ name: 'Belize Dollar', value: 'BZD' },
|
||||
{ name: 'Canadian Dollar', value: 'CAD' },
|
||||
{ name: 'Swiss Franc', value: 'CHF' },
|
||||
{ name: 'Chilean Peso', value: 'CLP' },
|
||||
{ name: 'Yuan Renminbi', value: 'CNY' },
|
||||
{ name: 'Colombian Peso', value: 'COP' },
|
||||
{ name: 'Costa Rican Colon', value: 'CRC' },
|
||||
{ name: 'Czech Koruna', value: 'CZK' },
|
||||
{ name: 'Danish Krone', value: 'DKK' },
|
||||
{ name: 'Dominican Peso', value: 'DOP' },
|
||||
{ name: 'Algerian Dinar', value: 'DZD' },
|
||||
{ name: 'Egyptian Pound', value: 'EGP' },
|
||||
{ name: 'Fiji Dollar', value: 'FJD' },
|
||||
{ name: 'Pound Sterling', value: 'GBP' },
|
||||
{ name: 'Quetzal', value: 'GTQ' },
|
||||
{ name: 'Hong Kong Dollar', value: 'HKD' },
|
||||
{ name: 'Lempira', value: 'HNL' },
|
||||
{ name: 'Kuna', value: 'HRK' },
|
||||
{ name: 'Forint', value: 'HUF' },
|
||||
{ name: 'Rupiah', value: 'IDR' },
|
||||
{ name: 'New Israeli Sheqel', value: 'ILS' },
|
||||
{ name: 'Indian Rupee', value: 'INR' },
|
||||
{ name: 'Jamaican Dollar', value: 'JMD' },
|
||||
{ name: 'Yen', value: 'JPY' },
|
||||
{ name: 'Kenyan Shilling', value: 'KES' },
|
||||
{ name: 'Won', value: 'KRW' },
|
||||
{ name: 'Tenge', value: 'KZT' },
|
||||
{ name: 'Lao Kip', value: 'LAK' },
|
||||
{ name: 'Lebanese Pound', value: 'LBP' },
|
||||
{ name: 'Sri Lanka Rupee', value: 'LKR' },
|
||||
{ name: 'Liberian Dollar', value: 'LRD' },
|
||||
{ name: 'Moroccan Dirham', value: 'MAD' },
|
||||
{ name: 'Kyat', value: 'MMK' },
|
||||
{ name: 'Pataca', value: 'MOP' },
|
||||
{ name: 'Ouguiya', value: 'MRO' },
|
||||
{ name: 'Mauritius Rupee', value: 'MUR' },
|
||||
{ name: 'Rufiyaa', value: 'MVR' },
|
||||
{ name: 'Mexican Peso', value: 'MXN' },
|
||||
{ name: 'Malaysian Ringgit', value: 'MYR' },
|
||||
{ name: 'Cordoba Oro', value: 'NIO' },
|
||||
{ name: 'Norwegian Krone', value: 'NOK' },
|
||||
{ name: 'Nepalese Rupee', value: 'NPR' },
|
||||
{ name: 'New Zealand Dollar', value: 'NZD' },
|
||||
{ name: 'Sol', value: 'PEN' },
|
||||
{ name: 'Kina', value: 'PGK' },
|
||||
{ name: 'Philippine Peso', value: 'PHP' },
|
||||
{ name: 'Pakistan Rupee', value: 'PKR' },
|
||||
{ name: 'Zloty', value: 'PLN' },
|
||||
{ name: 'Qatari Rial', value: 'QAR' },
|
||||
{ name: 'Romanian Leu', value: 'RON' },
|
||||
{ name: 'Russian Ruble', value: 'RUB' },
|
||||
{ name: 'Saudi Riyal', value: 'SAR' },
|
||||
{ name: 'Solomon Islands Dollar', value: 'SBD' },
|
||||
{ name: 'Seychelles Rupee', value: 'SCR' },
|
||||
{ name: 'Swedish Krona', value: 'SEK' },
|
||||
{ name: 'Singapore Dollar', value: 'SGD' },
|
||||
{ name: 'Syrian Pound', value: 'SYP' },
|
||||
{ name: 'Baht', value: 'THB' },
|
||||
{ name: 'Pa’anga', value: 'TOP' },
|
||||
{ name: 'Turkish Lira', value: 'TRY' },
|
||||
{ name: 'Trinidad and Tobago Dollar', value: 'TTD' },
|
||||
{ name: 'New Taiwan Dollar', value: 'TWD' },
|
||||
{ name: 'Hryvnia', value: 'UAH' },
|
||||
{ name: 'Dong', value: 'VND' },
|
||||
{ name: 'Vatu', value: 'VUV' },
|
||||
{ name: 'Tala', value: 'WST' },
|
||||
{ name: 'East Caribbean Dollar', value: 'XCD' },
|
||||
{ name: 'West African CFA Franc', value: 'XOF' },
|
||||
{ name: 'Yemeni Rial', value: 'YER' },
|
||||
{ name: 'Rand', value: 'ZAR' },
|
||||
];
|
||||
@@ -0,0 +1,275 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
address,
|
||||
currencies,
|
||||
makeCustomFieldsFixedCollection,
|
||||
makeGetAllFields,
|
||||
} from './SharedFields';
|
||||
|
||||
export const vendorOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a vendor',
|
||||
action: 'Create a vendor',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
||||
action: 'Create or update a vendor',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a vendor',
|
||||
action: 'Delete a vendor',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a vendor',
|
||||
action: 'Get a vendor',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many vendors',
|
||||
action: 'Get many vendors',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a vendor',
|
||||
action: 'Update a vendor',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const vendorFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// vendor: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor Name',
|
||||
name: 'vendorName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor Name',
|
||||
name: 'vendorName',
|
||||
description:
|
||||
'Name of the vendor. If a record with this vendor name exists it will be updated, otherwise a new one will be created.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: create + upsert
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['create', 'upsert'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
address,
|
||||
{
|
||||
displayName: 'Category',
|
||||
name: 'Category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'options',
|
||||
default: 'USD',
|
||||
options: currencies,
|
||||
},
|
||||
makeCustomFieldsFixedCollection('vendor'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor ID',
|
||||
name: 'vendorId',
|
||||
description: 'ID of the vendor to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor ID',
|
||||
name: 'vendorId',
|
||||
description: 'ID of the vendor to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: getAll
|
||||
// ----------------------------------------
|
||||
...makeGetAllFields('vendor'),
|
||||
|
||||
// ----------------------------------------
|
||||
// vendor: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Vendor ID',
|
||||
name: 'vendorId',
|
||||
description: 'ID of the vendor to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
address,
|
||||
{
|
||||
displayName: 'Category',
|
||||
name: 'Category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'Currency',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
makeCustomFieldsFixedCollection('vendor'),
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'Description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'Email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'Phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Vendor Name',
|
||||
name: 'Vendor_Name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Website',
|
||||
name: 'Website',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
export * from './AccountDescription';
|
||||
export * from './ContactDescription';
|
||||
export * from './DealDescription';
|
||||
export * from './InvoiceDescription';
|
||||
export * from './LeadDescription';
|
||||
export * from './ProductDescription';
|
||||
export * from './PurchaseOrderDescription';
|
||||
export * from './QuoteDescription';
|
||||
export * from './SalesOrderDescription';
|
||||
export * from './VendorDescription';
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
// ----------------------------------------
|
||||
// for generic functions
|
||||
// ----------------------------------------
|
||||
|
||||
type Resource =
|
||||
| 'account'
|
||||
| 'contact'
|
||||
| 'deal'
|
||||
| 'invoice'
|
||||
| 'lead'
|
||||
| 'product'
|
||||
| 'quote'
|
||||
| 'vendor';
|
||||
|
||||
export type CamelCaseResource = Resource | 'purchaseOrder' | 'salesOrder';
|
||||
|
||||
export type SnakeCaseResource = Resource | 'purchase_order' | 'sales_order';
|
||||
|
||||
export type GetAllFilterOptions = {
|
||||
fields: string[];
|
||||
[otherOptions: string]: unknown;
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// for auth
|
||||
// ----------------------------------------
|
||||
|
||||
export type ZohoOAuth2ApiCredentials = {
|
||||
oauthTokenData: {
|
||||
api_domain: string;
|
||||
};
|
||||
};
|
||||
|
||||
// ----------------------------------------
|
||||
// for field adjusters
|
||||
// ----------------------------------------
|
||||
|
||||
export type IdType = 'accountId' | 'contactId' | 'dealId' | 'purchaseOrderId';
|
||||
|
||||
export type NameType = 'Account_Name' | 'Full_Name' | 'Deal_Name' | 'Product_Name' | 'Vendor_Name';
|
||||
|
||||
export type LocationType =
|
||||
| 'Address'
|
||||
| 'Billing_Address'
|
||||
| 'Mailing_Address'
|
||||
| 'Shipping_Address'
|
||||
| 'Other_Address';
|
||||
|
||||
export type DateType =
|
||||
| 'Date_of_Birth'
|
||||
| 'Closing_Date'
|
||||
| 'Due_Date'
|
||||
| 'Invoice_Date'
|
||||
| 'PO_Date'
|
||||
| 'Valid_Till';
|
||||
|
||||
export type AllFields = { [Date in DateType]?: string } & {
|
||||
[Location in LocationType]?: { address_fields: { [key: string]: string } };
|
||||
} & { Account?: { subfields: { id: string; name: string } } } & {
|
||||
[key in 'accountId' | 'contactId' | 'dealId']?: string;
|
||||
} & { customFields?: { customFields: Array<{ fieldId: string; value: string }> } } & {
|
||||
Product_Details?: ProductDetails;
|
||||
} & IDataObject;
|
||||
|
||||
export type ProductDetails = Array<{ id: string; quantity: number }>;
|
||||
|
||||
export type ResourceItems = Array<{ [key: string]: string }>;
|
||||
|
||||
// ----------------------------------------
|
||||
// for resource loaders
|
||||
// ----------------------------------------
|
||||
|
||||
export type LoadedAccounts = Array<{
|
||||
Account_Name: string;
|
||||
id: string;
|
||||
}>;
|
||||
|
||||
export type LoadedContacts = Array<{
|
||||
Full_Name: string;
|
||||
id: string;
|
||||
}>;
|
||||
|
||||
export type LoadedDeals = Array<{
|
||||
Deal_Name: string;
|
||||
id: string;
|
||||
}>;
|
||||
|
||||
export type LoadedFields = {
|
||||
fields: Array<{
|
||||
field_label: string;
|
||||
api_name: string;
|
||||
custom_field: boolean;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type LoadedVendors = Array<{
|
||||
Vendor_Name: string;
|
||||
id: string;
|
||||
}>;
|
||||
|
||||
export type LoadedProducts = Array<{
|
||||
Product_Name: string;
|
||||
id: string;
|
||||
}>;
|
||||
|
||||
export type LoadedLayouts = {
|
||||
layouts: Array<{
|
||||
sections: Array<{
|
||||
api_name: string;
|
||||
fields: Array<{
|
||||
api_name: string;
|
||||
pick_list_values: Array<{
|
||||
display_value: string;
|
||||
actual_value: string;
|
||||
}>;
|
||||
}>;
|
||||
}>;
|
||||
}>;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.2 KiB |
Reference in New Issue
Block a user