Custom Node: How to have a collection options with specific display options?

Describe the problem/error/question

Is it possible to have specific display options for some Options of a collection?

(i.e. show all 20 options for all specified operations -in collection displayoption details-, except this one, show it if operation is xxx)?

As i have lots collections with many “common” options to multiple operations/actions… but with only one or two options differs based on operatio. And it seemed redundant to duplicate that collection multiple times for each resource/operation with small differences.

Tried this approach found in this topic here, without luck.

What is the error message (if any)?

Problem running workflow

Could not resolve parameter dependencies. Max iterations reached! Hint: If displayOptions are specified in any child parameter of a parent collection or fixedCollection, remove the displayOptions from the child parameter.

Please share your workflow

The custom node i’m building have multiple “resources”, each with multiple operations and fields.

Some “collection” fields are common to multiple operations in same resource, and others are 99% common.

So this is a snippet of one of the collection implementation needs for it (tried back slash method from 2021):

{
    displayName: 'Transaction Call Settings',
    name: 'transactionSettings',
    type: 'collection',
    placeholder: 'Add Transaction Settings',
    default: {},
    displayOptions: {
        show: {
            resource: ['transactions'],
            operation: ['createTransaction', 'updateTransaction'],
        },
    },
    options: [
        {
            displayName: 'Error If Duplicate Hash',
            name: 'error_if_duplicate_hash',
            type: 'boolean',
            default: true,
            description: 'Whether to throw an error if a duplicate hash is detected',
	        displayOptions: {
				show: {
					resource: ['/transactions'],
					operation: ['/createTransaction'],
				}
                },
	},
        {
            displayName: 'Apply Rules',
            name: 'apply_rules',
            type: 'boolean',
            default: false,
            description: 'Whether to apply rules to the transaction',
        },
        {
            displayName: 'Fire Webhooks',
            name: 'fire_webhooks',
            type: 'boolean',
            default: true,
            description: 'Whether to trigger webhooks for the transaction',
        },
        {
            displayName: 'Group Title',
            name: 'group_title',
            type: 'string',
            default: '',
            description: 'Title for grouping split transactions',
        },
    ],
},

Share the output returned by the last node

Error while testing, cannot run it.

Information on your n8n setup

  • n8n version: Version: 1.67.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not sure?
  • Running n8n via (Docker, npm, n8n cloud, desktop app): pnpm
  • Operating system: MACOS 15.1

Hi @Jihad,

I think displayOptions on options of a collection should work, even when the collection itself also has displayOptions. I found an example in the n8n codebase here.

In your snippet, in the error_if_duplicate_hash parameter, I think there is a mistake in the displayOptions. The slash should be in front of the keys like this:

show: {
	'/resource': ['transactions'],
	'/operation': ['createTransaction'],
}

Hope this helps!

2 Likes