Manage records

Describe the problem/error/question

Hi Team,

I have data with 8 records (16682150262-2, 16682150751-2, 20861273154-3, 20781035546-1). I need to manage these records where each row has the same ID but different rows exist due to associated contacts. For example, 16682150262 has two different associated contact email IDs.

Case 1: Merge Records with the Same ID

For records with the same ID, merge them into a single row, combining associated contact email IDs into the same column, separated by a delimiter (e.g., &).

|Column 1 | Column 2 | associated_contact|

|— | — | —|

|HS_wuSMlNTiAi6msjSd_16682150262 | HubSpot Company | [email protected] & [email protected] |

Could you please help here!!

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.234.1
  • Database (default: SQLite): postgresql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: MAC

Hi @Gouravdev, you could use a Code node (or maybe in your version it’s called Function node) to write a logic to transform the data, so maybe something like this?

Since you’re using an old version of n8n, this might not work though and I’d recommend upgrading to the later versions at some point for more functionalities and better performance :slight_smile:

2 Likes

it worked.
Thanks :slight_smile:
but data of associatedContactEmails is in arrary. Can we have it like I have mentioned.

@Gouravdev You can add a logic in the code node to join the items of the array. I updated the above workflow that includes this, hope that helps!

@aya could the summarize node also work here, if we wanted to avoid writing code?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.