n8n/packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1337 lines
46 KiB
TypeScript
Raw Normal View History

import type {
IExecuteFunctions,
2020-02-12 07:04:43 -08:00
IDataObject,
2020-02-15 16:23:22 -08:00
ILoadOptionsFunctions,
INodeExecutionData,
INodeType,
INodeTypeDescription,
2020-02-12 07:04:43 -08:00
} from 'n8n-workflow';
import {
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
addGetAllFilterOptions,
adjustAccountPayload,
adjustContactPayload,
adjustDealPayload,
adjustInvoicePayload,
adjustInvoicePayloadOnUpdate,
adjustLeadPayload,
adjustProductDetails,
adjustProductPayload,
adjustPurchaseOrderPayload,
adjustQuotePayload,
adjustSalesOrderPayload,
adjustVendorPayload,
getFields,
getPicklistOptions,
handleListing,
throwOnEmptyUpdate,
throwOnMissingProducts,
toLoadOptions,
2020-02-12 07:04:43 -08:00
zohoApiRequest,
zohoApiRequestAllItems,
} from './GenericFunctions';
import type {
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
CamelCaseResource,
GetAllFilterOptions,
LoadedAccounts,
LoadedContacts,
LoadedDeals,
LoadedProducts,
LoadedVendors,
ProductDetails,
} from './types';
2020-02-12 07:04:43 -08:00
2020-02-15 16:23:22 -08:00
import {
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
accountFields,
accountOperations,
contactFields,
contactOperations,
dealFields,
dealOperations,
invoiceFields,
invoiceOperations,
leadFields,
leadOperations,
productFields,
productOperations,
purchaseOrderFields,
purchaseOrderOperations,
quoteFields,
quoteOperations,
salesOrderFields,
salesOrderOperations,
vendorFields,
vendorOperations,
} from './descriptions';
2020-02-15 16:23:22 -08:00
2020-02-12 07:04:43 -08:00
export class ZohoCrm implements INodeType {
description: INodeTypeDescription = {
displayName: 'Zoho CRM',
name: 'zohoCrm',
icon: 'file:zoho.svg',
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
group: ['transform'],
2020-02-12 07:04:43 -08:00
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
version: 1,
description: 'Consume Zoho CRM API',
2020-02-12 07:04:43 -08:00
defaults: {
feat(editor): Node creator actions (#4696) * WIP: Node Actions List UI * WIP: Recommended Actions and preseting of fields * WIP: Resource category * :art: Moved actions categorisation to the server * :label: Add missing INodeAction type * :sparkles: Improve SSR categorisation, fix adding of mixed actions * :recycle: Refactor CategorizedItems to composition api, style fixes * WIP: Adding multiple nodes * :recycle: Refactor rest of the NodeCreator component to composition API, conver globalLinkActions to composable * :sparkles: Allow actions dragging, fix search and refactor passing of actions to categorized items * :lipstick: Fix node actions title * Migrate to the pinia store, add posthog feature and various fixes * :bug: Fix filtering of trigger actions when not merged * fix: N8N-5439 — Do not use simple node item when at NodeHelperPanel root * :bug: Design review fixes * :bug: Fix disabling of merged actions * Fix trigger root filtering * :sparkles: Allow for custom node actions parser, introduce hubspot parser * :bug: Fix initial node params validation, fix position of second added node * :bug: Introduce operations category, removed canvas node names overrride, fix API actions display and prevent dragging of action nodes * :sparkles: Prevent NDV auto-open feature flag * :bug: Inject recommened action for trigger nodes without actions * Refactored NodeCreatorNode to Storybook, change filtering of merged nodes for the trigger helper panel, minor fixes * Improve rendering of app nodes and animation * Cleanup, any only enable accordion transition on triggerhelperpanel * Hide node creator scrollbars in Firefox * Minor styles fixes * Do not copy the array in rendering method * Removed unused props * Fix memory leak * Fix categorisation of regular nodes with a single resource * Implement telemetry calls for node actions * Move categorization to FE * Fix client side actions categorisation * Skip custom action show * Only load tooltip for NodeIcon if necessary * Fix lodash startCase import * Remove lodash.startcase * Cleanup * Fix node creator autofocus on "tab" * Prevent posthog getFeatureFlag from crashing * Debugging preview env search issues * Remove logs * Make sure the pre-filled params are update not overwritten * Get rid of transition in itemiterator * WIP: Rough version of NodeActions keyboard navigation, replace nodeCreator composable with Pinia store module * Rewrite to add support for ActionItem to ItemIterator and make CategorizedItems accept items props * Fix category item counter & cleanup * Add APIHint to actions search no-result, clean up NodeCreatorNode * Improve node actions no results message * Remove logging, fix filtering of recommended placeholder category * Remove unused NodeActions component and node merging feature falg * Do not show regular nodes without actions * Make sure to add manual trigger when adding http node via actions hint * Fixed api hint footer line height * Prevent pointer-events od NodeIcon img and remove "this" from template * Address PR points * Fix e2e specs * Make sure canvas ia loaded * Make sure canvas ia loaded before opening nodeCreator in e2e spec * Fix flaky workflows tags e2e getter * Imrpove node creator click outside UX, add manual node to regular nodes added from trigger panel * Add manual trigger node if dragging regular from trigger panel
2022-12-09 01:56:36 -08:00
name: 'Zoho CRM',
2020-02-12 07:04:43 -08:00
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'zohoOAuth2Api',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
refactor: Apply more nodelinting rules (#3324) * :pencil2: Alphabetize lint rules * :fire: Remove duplicates * :zap: Update `lintfix` script * :shirt: Apply `node-param-operation-without-no-data-expression` (#3329) * :shirt: Apply `node-param-operation-without-no-data-expression` * :shirt: Add exceptions * :shirt: Apply `node-param-description-weak` (#3328) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-value-duplicate` (#3331) * :shirt: Apply `node-param-description-miscased-json` (#3337) * :shirt: Apply `node-param-display-name-excess-inner-whitespace` (#3335) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-type-options-missing-from-limit` (#3336) * Rule workig as intended * :pencil2: Uncomment rules Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-name-duplicate` (#3338) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-description-wrong-for-simplify` (#3334) * :zap: fix * :zap: exceptions * :zap: changed rule ignoring from file to line * :shirt: Apply `node-param-resource-without-no-data-expression` (#3339) * :shirt: Apply `node-param-display-name-untrimmed` (#3341) * :shirt: Apply `node-param-display-name-miscased-id` (#3340) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-resource-with-plural-option` (#3342) * :shirt: Apply `node-param-description-wrong-for-upsert` (#3333) * :zap: fix * :zap: replaced record with contact in description * :zap: fix Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-description-identical-to-name` (#3343) * :shirt: Apply `node-param-option-name-containing-star` (#3347) * :shirt: Apply `node-param-display-name-wrong-for-update-fields` (#3348) * :shirt: Apply `node-param-option-name-wrong-for-get-all` (#3345) * :zap: fix * :zap: exceptions * :shirt: Apply node-param-display-name-wrong-for-simplify (#3344) * Rule working as intended * Uncomented other rules * :shirt: Undo and add exceptions Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :zap: Alphabetize lint rules * :zap: Restore `lintfix` script Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
2022-05-20 14:47:24 -07:00
noDataExpression: true,
2020-02-12 07:04:43 -08:00
options: [
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
{
name: 'Account',
value: 'account',
},
{
name: 'Contact',
value: 'contact',
},
{
name: 'Deal',
value: 'deal',
},
{
name: 'Invoice',
value: 'invoice',
},
2020-02-12 07:04:43 -08:00
{
name: 'Lead',
value: 'lead',
},
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
{
name: 'Product',
value: 'product',
},
{
name: 'Purchase Order',
value: 'purchaseOrder',
},
{
name: 'Quote',
value: 'quote',
},
{
name: 'Sales Order',
value: 'salesOrder',
},
{
name: 'Vendor',
value: 'vendor',
},
2020-02-12 07:04:43 -08:00
],
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
default: 'account',
2020-02-12 07:04:43 -08:00
},
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
...accountOperations,
...accountFields,
...contactOperations,
...contactFields,
...dealOperations,
...dealFields,
...invoiceOperations,
...invoiceFields,
2020-02-12 07:04:43 -08:00
...leadOperations,
...leadFields,
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
...productOperations,
...productFields,
...purchaseOrderOperations,
...purchaseOrderFields,
...quoteOperations,
...quoteFields,
...salesOrderOperations,
...salesOrderFields,
...vendorOperations,
...vendorFields,
2020-02-12 07:04:43 -08:00
],
};
2020-02-15 16:23:22 -08:00
methods = {
loadOptions: {
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
// ----------------------------------------
// resources
// ----------------------------------------
async getAccounts(this: ILoadOptionsFunctions) {
const accounts = (await zohoApiRequestAllItems.call(
this,
'GET',
'/accounts',
)) as LoadedAccounts;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return toLoadOptions(accounts, 'Account_Name');
},
async getContacts(this: ILoadOptionsFunctions) {
const contacts = (await zohoApiRequestAllItems.call(
this,
'GET',
'/contacts',
)) as LoadedContacts;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return toLoadOptions(contacts, 'Full_Name');
},
async getDeals(this: ILoadOptionsFunctions) {
const deals = (await zohoApiRequestAllItems.call(this, 'GET', '/deals')) as LoadedDeals;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return toLoadOptions(deals, 'Deal_Name');
},
async getProducts(this: ILoadOptionsFunctions) {
const products = (await zohoApiRequestAllItems.call(
this,
'GET',
'/products',
)) as LoadedProducts;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return toLoadOptions(products, 'Product_Name');
},
async getVendors(this: ILoadOptionsFunctions) {
const vendors = (await zohoApiRequestAllItems.call(
this,
'GET',
'/vendors',
)) as LoadedVendors;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return toLoadOptions(vendors, 'Vendor_Name');
},
// ----------------------------------------
// resource fields
// ----------------------------------------
// standard fields - called from `makeGetAllFields`
async getAccountFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'account');
},
async getContactFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'contact');
},
async getDealFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'deal');
},
async getInvoiceFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'invoice');
},
async getLeadFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'lead');
},
async getProductFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'product');
},
async getPurchaseOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'purchase_order');
},
async getVendorOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'vendor');
},
async getQuoteFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'quote');
},
async getSalesOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'sales_order');
},
async getVendorFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'vendor');
},
// custom fields
async getCustomAccountFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'account', { onlyCustom: true });
},
async getCustomContactFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'contact', { onlyCustom: true });
},
async getCustomDealFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'deal', { onlyCustom: true });
},
async getCustomInvoiceFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'invoice', { onlyCustom: true });
},
async getCustomLeadFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'lead', { onlyCustom: true });
},
async getCustomProductFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'product', { onlyCustom: true });
},
async getCustomPurchaseOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'purchase_order', { onlyCustom: true });
},
async getCustomVendorOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'vendor', { onlyCustom: true });
},
async getCustomQuoteFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'quote', { onlyCustom: true });
},
async getCustomSalesOrderFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'sales_order', { onlyCustom: true });
},
async getCustomVendorFields(this: ILoadOptionsFunctions) {
return getFields.call(this, 'vendor', { onlyCustom: true });
},
// ----------------------------------------
// resource picklist options
// ----------------------------------------
async getAccountType(this: ILoadOptionsFunctions) {
return getPicklistOptions.call(this, 'account', 'Account_Type');
},
async getDealStage(this: ILoadOptionsFunctions) {
return getPicklistOptions.call(this, 'deal', 'Stage');
},
async getPurchaseOrderStatus(this: ILoadOptionsFunctions) {
return getPicklistOptions.call(this, 'purchaseOrder', 'Status');
},
async getSalesOrderStatus(this: ILoadOptionsFunctions) {
return getPicklistOptions.call(this, 'salesOrder', 'Status');
},
async getQuoteStage(this: ILoadOptionsFunctions) {
return getPicklistOptions.call(this, 'quote', 'Quote_Stage');
2020-02-15 16:23:22 -08:00
},
},
};
2020-02-12 07:04:43 -08:00
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
const resource = this.getNodeParameter('resource', 0) as CamelCaseResource;
const operation = this.getNodeParameter('operation', 0);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
2020-02-12 07:04:43 -08:00
let responseData;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
for (let i = 0; i < items.length; i++) {
// https://www.zoho.com/crm/developer/docs/api/insert-records.html
// https://www.zoho.com/crm/developer/docs/api/get-records.html
// https://www.zoho.com/crm/developer/docs/api/update-specific-record.html
// https://www.zoho.com/crm/developer/docs/api/delete-specific-record.html
// https://www.zoho.com/crm/developer/docs/api/v2/upsert-records.html
try {
if (resource === 'account') {
// **********************************************************************
// account
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/accounts-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Accounts
if (operation === 'create') {
// ----------------------------------------
// account: create
// ----------------------------------------
const body: IDataObject = {
Account_Name: this.getNodeParameter('accountName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustAccountPayload(additionalFields));
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
responseData = await zohoApiRequest.call(this, 'POST', '/accounts', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// account: delete
// ----------------------------------------
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/accounts/${accountId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// account: get
// ----------------------------------------
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/accounts/${accountId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// account: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/accounts', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// account: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustAccountPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/accounts/${accountId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// account: upsert
// ----------------------------------------
const body: IDataObject = {
Account_Name: this.getNodeParameter('accountName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustAccountPayload(additionalFields));
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
responseData = await zohoApiRequest.call(this, 'POST', '/accounts/upsert', body);
responseData = responseData.data[0].details;
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
} else if (resource === 'contact') {
// **********************************************************************
// contact
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/contacts-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Contacts
if (operation === 'create') {
// ----------------------------------------
// contact: create
// ----------------------------------------
const body: IDataObject = {
Last_Name: this.getNodeParameter('lastName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustContactPayload(additionalFields));
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
responseData = await zohoApiRequest.call(this, 'POST', '/contacts', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// contact: delete
// ----------------------------------------
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// contact: get
// ----------------------------------------
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// contact: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/contacts', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// contact: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustContactPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// contact: upsert
// ----------------------------------------
const body: IDataObject = {
Last_Name: this.getNodeParameter('lastName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustContactPayload(additionalFields));
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
responseData = await zohoApiRequest.call(this, 'POST', '/contacts/upsert', body);
responseData = responseData.data[0].details;
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
} else if (resource === 'deal') {
// **********************************************************************
// deal
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/deals-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Deals
if (operation === 'create') {
// ----------------------------------------
// deal: create
// ----------------------------------------
const body: IDataObject = {
Deal_Name: this.getNodeParameter('dealName', i),
Stage: this.getNodeParameter('stage', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustDealPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/deals', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// deal: delete
// ----------------------------------------
const dealId = this.getNodeParameter('dealId', i);
responseData = await zohoApiRequest.call(this, 'DELETE', `/deals/${dealId}`);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// deal: get
// ----------------------------------------
const dealId = this.getNodeParameter('dealId', i);
responseData = await zohoApiRequest.call(this, 'GET', `/deals/${dealId}`);
2020-02-15 16:23:22 -08:00
responseData = responseData.data;
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
} else if (operation === 'getAll') {
// ----------------------------------------
// deal: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/deals', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// deal: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustDealPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const dealId = this.getNodeParameter('dealId', i);
responseData = await zohoApiRequest.call(this, 'PUT', `/deals/${dealId}`, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// deal: upsert
// ----------------------------------------
const body: IDataObject = {
Deal_Name: this.getNodeParameter('dealName', i),
Stage: this.getNodeParameter('stage', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustDealPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/deals/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'invoice') {
// **********************************************************************
// invoice
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/invoices-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Invoices
if (operation === 'create') {
// ----------------------------------------
// invoice: create
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
throwOnMissingProducts.call(this, resource, productDetails);
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustInvoicePayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/invoices', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// invoice: delete
// ----------------------------------------
const invoiceId = this.getNodeParameter('invoiceId', i);
const endpoint = `/invoices/${invoiceId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// invoice: get
// ----------------------------------------
const invoiceId = this.getNodeParameter('invoiceId', i);
const endpoint = `/invoices/${invoiceId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// invoice: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/invoices', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// invoice: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustInvoicePayloadOnUpdate(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const invoiceId = this.getNodeParameter('invoiceId', i);
const endpoint = `/invoices/${invoiceId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// invoice: upsert
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustInvoicePayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/invoices/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'lead') {
// **********************************************************************
// lead
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/leads-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Leads
if (operation === 'create') {
// ----------------------------------------
// lead: create
// ----------------------------------------
const body: IDataObject = {
Company: this.getNodeParameter('Company', i),
Last_Name: this.getNodeParameter('lastName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustLeadPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/leads', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// lead: delete
// ----------------------------------------
const leadId = this.getNodeParameter('leadId', i);
responseData = await zohoApiRequest.call(this, 'DELETE', `/leads/${leadId}`);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// lead: get
// ----------------------------------------
const leadId = this.getNodeParameter('leadId', i);
responseData = await zohoApiRequest.call(this, 'GET', `/leads/${leadId}`);
} else if (operation === 'getAll') {
// ----------------------------------------
// lead: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/leads', {}, qs);
} else if (operation === 'getFields') {
// ----------------------------------------
// lead: getFields
// ----------------------------------------
responseData = await zohoApiRequest.call(
this,
'GET',
'/settings/fields',
{},
{ module: 'leads' },
);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
responseData = responseData.fields;
} else if (operation === 'update') {
// ----------------------------------------
// lead: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustLeadPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const leadId = this.getNodeParameter('leadId', i);
responseData = await zohoApiRequest.call(this, 'PUT', `/leads/${leadId}`, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// lead: upsert
// ----------------------------------------
const body: IDataObject = {
Company: this.getNodeParameter('Company', i),
Last_Name: this.getNodeParameter('lastName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustLeadPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/leads/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'product') {
// **********************************************************************
// product
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/products-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Products
if (operation === 'create') {
// ----------------------------------------
// product: create
// ----------------------------------------
const body: IDataObject = {
Product_Name: this.getNodeParameter('productName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustProductPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/products', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// product: delete
// ----------------------------------------
const productId = this.getNodeParameter('productId', i);
const endpoint = `/products/${productId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// product: get
// ----------------------------------------
const productId = this.getNodeParameter('productId', i);
const endpoint = `/products/${productId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// product: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/products', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// product: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustProductPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const productId = this.getNodeParameter('productId', i);
const endpoint = `/products/${productId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// product: upsert
// ----------------------------------------
const body: IDataObject = {
Product_Name: this.getNodeParameter('productName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustProductPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/products/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'purchaseOrder') {
// **********************************************************************
// purchaseOrder
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/purchase-orders-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Purchase_Order
if (operation === 'create') {
// ----------------------------------------
// purchaseOrder: create
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
throwOnMissingProducts.call(this, resource, productDetails);
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Vendor_Name: { id: this.getNodeParameter('vendorId', i) },
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustPurchaseOrderPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/purchase_orders', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// purchaseOrder: delete
// ----------------------------------------
const purchaseOrderId = this.getNodeParameter('purchaseOrderId', i);
const endpoint = `/purchase_orders/${purchaseOrderId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// purchaseOrder: get
// ----------------------------------------
const purchaseOrderId = this.getNodeParameter('purchaseOrderId', i);
const endpoint = `/purchase_orders/${purchaseOrderId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// purchaseOrder: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/purchase_orders', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// purchaseOrder: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustPurchaseOrderPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const purchaseOrderId = this.getNodeParameter('purchaseOrderId', i);
const endpoint = `/purchase_orders/${purchaseOrderId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// purchaseOrder: upsert
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Vendor_Name: { id: this.getNodeParameter('vendorId', i) },
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustPurchaseOrderPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/purchase_orders/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'quote') {
// **********************************************************************
// quote
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/quotes-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Quotes
if (operation === 'create') {
// ----------------------------------------
// quote: create
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
throwOnMissingProducts.call(this, resource, productDetails);
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustQuotePayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/quotes', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// quote: delete
// ----------------------------------------
const quoteId = this.getNodeParameter('quoteId', i);
responseData = await zohoApiRequest.call(this, 'DELETE', `/quotes/${quoteId}`);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// quote: get
// ----------------------------------------
const quoteId = this.getNodeParameter('quoteId', i);
responseData = await zohoApiRequest.call(this, 'GET', `/quotes/${quoteId}`);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// quote: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/quotes', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// quote: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustQuotePayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const quoteId = this.getNodeParameter('quoteId', i);
responseData = await zohoApiRequest.call(this, 'PUT', `/quotes/${quoteId}`, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// quote: upsert
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
const body: IDataObject = {
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustQuotePayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/quotes/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'salesOrder') {
// **********************************************************************
// salesOrder
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/sales-orders-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Sales_Orders
if (operation === 'create') {
// ----------------------------------------
// salesOrder: create
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
const body: IDataObject = {
Account_Name: { id: this.getNodeParameter('accountId', i) },
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustSalesOrderPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/sales_orders', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// salesOrder: delete
// ----------------------------------------
const salesOrderId = this.getNodeParameter('salesOrderId', i);
const endpoint = `/sales_orders/${salesOrderId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// salesOrder: get
// ----------------------------------------
const salesOrderId = this.getNodeParameter('salesOrderId', i);
const endpoint = `/sales_orders/${salesOrderId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// salesOrder: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/sales_orders', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// salesOrder: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustSalesOrderPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const salesOrderId = this.getNodeParameter('salesOrderId', i);
const endpoint = `/sales_orders/${salesOrderId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// salesOrder: upsert
// ----------------------------------------
const productDetails = this.getNodeParameter('Product_Details', i) as ProductDetails;
const body: IDataObject = {
Account_Name: { id: this.getNodeParameter('accountId', i) },
Subject: this.getNodeParameter('subject', i),
Product_Details: adjustProductDetails(productDetails, 'upsert'),
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustSalesOrderPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/sales_orders/upsert', body);
responseData = responseData.data[0].details;
}
} else if (resource === 'vendor') {
// **********************************************************************
// vendor
// **********************************************************************
// https://www.zoho.com/crm/developer/docs/api/v2/vendors-response.html
// https://help.zoho.com/portal/en/kb/crm/customize-crm-account/customizing-fields/articles/standard-modules-fields#Vendors
if (operation === 'create') {
// ----------------------------------------
// vendor: create
// ----------------------------------------
const body: IDataObject = {
Vendor_Name: this.getNodeParameter('vendorName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustVendorPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/vendors', body);
responseData = responseData.data[0].details;
} else if (operation === 'delete') {
// ----------------------------------------
// vendor: delete
// ----------------------------------------
const vendorId = this.getNodeParameter('vendorId', i);
const endpoint = `/vendors/${vendorId}`;
responseData = await zohoApiRequest.call(this, 'DELETE', endpoint);
responseData = responseData.data[0].details;
} else if (operation === 'get') {
// ----------------------------------------
// vendor: get
// ----------------------------------------
const vendorId = this.getNodeParameter('vendorId', i);
const endpoint = `/vendors/${vendorId}`;
responseData = await zohoApiRequest.call(this, 'GET', endpoint);
responseData = responseData.data;
} else if (operation === 'getAll') {
// ----------------------------------------
// vendor: getAll
// ----------------------------------------
const qs: IDataObject = {};
const options = this.getNodeParameter('options', i) as GetAllFilterOptions;
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/vendors', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// vendor: update
// ----------------------------------------
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(updateFields).length) {
Object.assign(body, adjustVendorPayload(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const vendorId = this.getNodeParameter('vendorId', i);
const endpoint = `/vendors/${vendorId}`;
responseData = await zohoApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.data[0].details;
} else if (operation === 'upsert') {
// ----------------------------------------
// vendor: upsert
// ----------------------------------------
const body: IDataObject = {
Vendor_Name: this.getNodeParameter('vendorName', i),
};
const additionalFields = this.getNodeParameter('additionalFields', i);
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustVendorPayload(additionalFields));
}
responseData = await zohoApiRequest.call(this, 'POST', '/vendors/upsert', body);
responseData = responseData.data[0].details;
}
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message, json: {} });
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
continue;
2020-02-15 16:23:22 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
throw error;
2020-02-12 07:04:43 -08:00
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
2020-02-12 07:04:43 -08:00
}
:zap: Expand Zoho node (#1763) * :zap: Initial refactor of Zoho node * :zap: Refactor out extra credentials parameter * :fire: Remove unused filters * :zap: Fix date of birth fields * :zap: Fix param casing * :zap: Adjust param types * :zap: Adjust invoice operations * :zap: Refactor types in adjusters * :zap: Add product resource * :zap: Refactor product details field * :zap: Adjust purchase order params * :zap: Adjust quote params * :zap: Adjust sales orders params * :fire: Remove old unused files * :zap: Add vendor resource * :zap: Fix minor details * :zap: Implement continueOnFail * :bug: Fix empty response for getAll * :zap: Simplify response for single item * :fire: Remove unused import * :hammer: Restore old node name * :zap: Prevent request on empty update * :zap: Apply Dali's suggestions * :zap: Improvements * :zap: Add filters for lead:getAll * :zap: Add upsert to all resources * :zap: Add filters to all getAll operations * :hammer: Restore continue on fail * :hammer: Refactor upsert addition * :hammer: Refactor getFields for readability * :zap: Add custom fields to all create-update ops * :zap: Implement custom fields adjuster * :fire: Remove logging * :shirt: Appease linter * :shirt: Refactor type helper for linter * :zap: Fix refactored type * :hammer: Refactor reduce for simplicity * :zap: Fix vendor:getAll filter options * :zap: Fix custom fields for product operations * :zap: Make sort_by into options param * :truck: Rename upsert operation * :pencil2: Add descriptions to upsert * :zap: Deduplicate system-defined check fields * :hammer: Re-order address fields * :pencil2: Generalize references in getAll fields * :fire: Remove extra comma * :zap: Make getFields helper more readable * :pencil2: Touch up description for account ID * :fire: Remove currency from contacts * :hammer: Resort emails and phones for contact * :bug: Fix sales cycle duration param type * :pencil2: Clarify descriptions with percentages * :hammer: Reorder total fields * :pencil2: Clarify percentages for discounts * :pencil2: Clarify percentages for commissions * :hammer: Convert currency to picklist * :pencil2: Add documentation links * :zap: Add resource loaders for picklists * :zap: Fix build * :hammer: Refactor product details * :zap: Add resolve data to all resources * :zap: Change resolve data toggle default * :zap: Restore lead:getFields operation * :fire: Remove upsert descriptions * :hammer: Change casing for upsert operations * :zap: Add operation descriptions * :hammer: Restore makeResolve default value * :hammer: Return nested details * :zap: Reposition Resolve Data toggles * :pencil2: Document breaking changes * Revert "Reposition Resolve Data toggles" This reverts commit 72ac41780b3ebec9cc6a5bf527e154ffe6ed884a. * :zap: Improvements Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
2021-07-02 14:34:12 -07:00
return [returnData];
2020-02-12 07:04:43 -08:00
}
}