How can I match two values within the same dataset, then modify one from the other?

Hello all. I am trying to sync my Todoist tasks to Notion. Currently I am able to do this for flat tasks, however I want to sync the Parent / Child relationships to Notion as well. I need some help with creating nodes which can achieve this result.

So far, I have accomplished the following:

  • Setup Todoist and Notion accounts.
  • Created a testing ground within both for syncing some dummy data.
  • Synced some flat tasks from Todoist to the Notion database.
  • Synced properties such as Due, Priority, Description, from Todoist task into Notion page.

The Todoist subtask relationship works as follows:

  • All tasks have a property (provided by Todoist) named id containing a unique number.
  • All tasks also have another property named parent_id which is the same concept as id.
  • Child tasks have a value in the parent_id field which correlates to the same id of the parent task.
  • Parent tasks have a null value in the parent_id field.


  • Parent task named Parent with an ID 123 and a parent ID null
  • Child task named Child with an ID 456 and a parent ID 123
  • Sub-sub-sub tasks can repeat in this way. Turtles all the way down.

My goal for this workflow is as follows:

  • Get all the tasks from Todoist (e.g. Parent, and Child) from a provided list.
  • Before sending to Notion, I want to match the child tasks to the parent tasks by their name, using a property (?) to store the Name.
    – For instance, in the example above, the Child task would have Parent Name created within its JSON structure and then the value Name from the Parent would be stored into it within the Child.
  • Then this would be passed to the next node which would Create/Update the Notion page for that task.
    – Any values within the Parent Name field would then be passed to a subfunction which would get the URL of the parent task from the Notion database, and then take that URL and store it into a Relation field in the Child task. This would effectively create a Parent / Child relationship between the tasks inside of Notion. (I can handle this part of the goal I believe)

Request for assistance

I am struggling to write the logic/nodes for matching the Parent ID of child tasks to the ID of parent tasks, and then storing them into the proper place to be passed along to the next nodes for processing into Notion.

I have created the below nodes. They are messy, but I have found that it technically does work. Not only do I want it to be more efficient however, the other issue with what I’ve created is that it only passes along the parent/child merged data, and that data is in a different format than the source data (due to the compare node).

Is there any way to process this using other methods, perhaps a JavaScript code node, or something else? If JavaScript is the best choice, I am only a novice at JavaScript and don’t yet know enough to write one myself, so some help would be welcome. I am also open to renovating the whole idea if someone suggests something that makes me think differently about it.

My existing workflow:

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