Property options that depend on other properties [GOT CREATED]

sometimes the value(s) of a node property are dependant on the value of another node property. For example in Asana, there exist both “Workspaces” and “Projects”. In the existing Asana integration, https://github.com/n8n-io/n8n/blob/af5c7e75fac8ed23ac01e77baed9ecdf09e93055/packages/nodes-base/nodes/Asana/Asana.node.ts, the workspaces are loaded with loadOptions (works well), but there is no property for “project”. Now I tried to add it, but it’s not that easy, because in order to get the relevant project ids, you need the workspace id.

So there needs to be a way to mark a node property as dependant on another property. If property B is dependant on A, then if A changes, the loadOptions function is called (again). I realize that this is not trivial, as you need to check depth of depdency / circular dependency etc., but it’s quite necessary in my opinion.

This is similar to [Node Creation] How can I get previous properties in loadOptionsMethod.

However, I want to use the results from loadOptions in the same node. But I guess it makes sense to expose them for later nodes, too.

If someone stumbles across this, for this usecase there is now an option called loadOptionsDependsOn where you can pass the name of another property.

			{
			displayName: 'Section',
			name: 'section',
			type: 'options',
			typeOptions: {
				loadOptionsMethod: 'getSections',
				loadOptionsDependsOn: [
					'projectId',
				],
			},
			options: [],
			[...]
1 Like