Master advanced n8n workflow techniques. This n8n template shows how to use the itemMatching() function in a Python code n8n node to restore original data fields after preceding data transformations.
Download this n8n workflow template and start using it instantly.
This automation is ideal for:
n8n developers learning advanced scripting techniques.
Users needing reliable methods to preserve data lineage across complex n8n workflows.
Engineers building modular n8n templates where item indices must be maintained for data correlation.
Anyone seeking a deeper understanding of data manipulation within the n8n execution context.
When building complex n8n workflows, you often need to transform or filter data streams, which can sometimes result in the temporary loss of original fields (like emails or IDs). This specific n8n workflow provides a robust solution using the built-in itemMatching() function available within the Code n8n node.
The value of this n8n automation is in ensuring data integrity. It simulates a scenario where initial data is generated, then aggressively pruned (keeping only names), and finally, the original email address is accurately retrieved and restored using item index correlation. This approach is vital for advanced data manipulation and demonstrates one of the most powerful features available in the n8n scripting environment for linking data items across different stages of the n8n workflow.
This n8n workflow operates in four distinct phases:
Customer Datastore (n8n training) n8n node generates a list of sample customer records, including names and email addresses. This establishes the initial data stream.Edit Fields (Set) n8n node intentionally strips away all fields except the customer name. This simulates a common scenario where data is streamlined, and the original context is seemingly lost.itemMatching(i) method, referencing the original data output from the 'Customer Datastore' n8n node, to retrieve the corresponding email address based on the index i. This retrieved email is then appended back to the current item under a new field called restoreEmail. This powerful technique ensures data consistency throughout the n8n workflow.To deploy this n8n template, follow these steps:
This n8n workflow leverages the following key n8n node types:
When clicking "Execute Workflow" (Manual Trigger):
Function: Acts as the starting n8n trigger for testing and development.
Key Configuration: No configuration required; starts the n8n workflow on demand.
Customer Datastore (n8n training):
Function: Generates sample data (customers with names and emails) to provide a source data stream.
Key Configuration: Operation set to getAllPeople, with returnAll checked.
Edit Fields (Set):
Function: This n8n node performs a data transformation, reducing the incoming items to only retain the 'name' field. This simulates the data loss scenario we intend to fix.
Key Configuration: Includes only the name field, setting the input option to none to discard all other fields.
Code (Python):
Function: The critical n8n node where the itemMatching() method is used. It correlates the current item index with the original index from the 'Customer Datastore' to pull the original email.
Key Configuration: Uses Python logic:
for i,item in enumerate(input.all()):
input.all()[i].json.restoreEmail = ('Customer Datastore (n8n training)').itemMatching(i).json.email
return input.all(); This demonstrates how powerful custom scripting can be in an n8n workflow.Automate nutritional tracking with this advanced n8n workflow. It analyzes food photos sent via iMessage using GPT-4 Vision, maintains history in a Postgres database, and replies with detailed, conversational summaries. Leverage this n8n template today.

A secure n8n workflow designed to dynamically fetch and return the public IP address(es) of the hosting n8n instance using a Header-Authenticated n8n trigger. Ideal for DevOps teams.

Use this advanced n8n workflow to expose over 30 eBay Account API operations (policies, payments, taxes, fulfillment) as tools for an external AI Agent using the specialized n8n trigger.

Use this robust n8n workflow to automate complex job scraping from LinkedIn and Indeed via Bright Data. Trigger searches via an n8n form and save the aggregated job listings directly to Google Sheets for comparison.


Meet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.







































