Trying to re-connect all entries to one new entry

Hi Community,
this is my very first automation here and I’m already a little overwhelmed.

So I’m starting with a notion database, containing a self-referencing property. All items in it are matched to the newest item in the top spot of the database through property ->1.

Now when I’m creating a new entry, which by default is called “Title” I want it to have all other entries linked to it instead.

Is there a way to automate this in Make? I really couldn’t figure it out. Help would be hugely appreciated!

In case this detail matters: to unmatch the previous items under ->1 manually, I need to unselect the new empty “Title”-entry. Otherwise the [-] Button doesn’t show up like seen here:

Hello @Oscar3. Welcome to the Make Community.

Don’t worry, when we start with Make, it’s always overwhelming. And then, the more we learn it, the easier it becomes :slight_smile:

May I ask you exactly what you want to achieve here? I didn’t understand everything. Are you trying to insert a new record in this Notion database from Make? What is the self-referencing property used for?
Can you please share what you did so far in Make?
I played already a little with Notion databases, but I always used a simple database with classic fields. I would like to help, but I would need more details.

Cheers,

Benjamin

1 Like

Hi Benjamin,

thank you so much for taking on on the challenge! Much appreciated :hugs:

So what the entire setup is used for, is a “next/previous”-Button. You can read a little more here (especially the last gif shows it quite well):
https://www.reddit.com/r/Notion/comments/1h9qwkc/next_prev_buttons_in_database_page/

And to not have to manually re-assign all the entries after I created a new “Title”-item, I would love to use Make for that.

(And what I did so far is this, but it’s not much for the long time I already spent…)
blueprint.json (230.5 KB)

Hello @Oscar3,

thanks for the complementary details!
I wanted to try and rephrase to make sure I got it, if you don’t mind :slight_smile:

You have a “Articles” database, that includes multiple records. When you add a new article, the next article (so the last before you add the new one) should point to it. The end goal is to be able to browse all articles in Notion with a Next/Previous button. Is that correct?

And if yes, have I correctly understood that each article has a link to the next and the previous one? Meaning that Art1 has a link to Art2, that has a link to Art1 and Art3, that has a link to Art2 and Art4, and so on?

Sorry for asking more and more questions, we have to try and match your way to explain what you want to achieve, with the way I understand things :upside_down_face:

1 Like

Ah hey Benjamin,
thanks for rephrasing, helps to see some details!
You generally got it right, yup :+1:

Only detail that is very important:
When I add a new article, every other article should point to the new article.

So taking the example of the pictures I provided, “Nevermind” was the newest article before I added “Title” as a new article.
Now Make should delete “Nevermind” from the column “->1” and put “Title” there instead (including to it’s own spot in “->1” which is currently empty)

1 Like

Should it be similar to this?

If yes, are you adding the new Article from Make, or for example manually? I ask because if it’s manual, it means you want Make to search for the newest article, and then fill the relation for the other articles.

If you create the article from Make, it will be a little simpler.

If I add an Article4, it looks like this


Is it the way you want? I can see that Article4 now has a link to all the other articles that point to it. I’m not an expert in Notion; is it what you expect for the latest article?

Benjamin

1 Like

Oh, interesting!
I mean, I want to create the article in Notion and not leave the app for creating a new article. So if that’s what you mean by manually, then yes.
Going to Make and starting the process there sounds a little cumbersome.

But I like what zou do with your article4, thats what I want :slight_smile:

@Oscar3 If I got it right, if you want to add a new Article, and then have Make update all the relation fields of other articles automatically, you will need the following to create a scenario that will detect your new article and update everything. This scenario can use the “Notion / Watch Database Items” module. It allows to retrieve only the new records. This scenario will then update all articles.

you can decide to schedule this scenario so that it runs regularly, so that you don’t need to care about it. The schedule frequency will depend on your requirements. For instance, if you want your Articles to be updated rapidly, you may want to schedule the scenario to execute every 5 minutes. (but it will consume operations, be mindful that each execution will consume a minimum of one operation). Or you can decide to configure a longer scheduling, but your articles will not be updated until the scenario runs. So it has to be a good balance.
OR, you configure the scenario to be Run On-Demand. And in that case you can run it manually anytime, or, even better, if you have a Make paid plan, you can call it from the Make API. And even better, if you have a Notion paid-plan, you could trigger the scenario from there.

Now for the scenario
You need 3 modules:

Module 1: “Notion / Watch Database Items”: it can detect new Articles. If you entered more than one article, it will return you multiple records, so you may need logic to get only the latest.
Module 2: “Notion / Search Objects”: It will allow you to load all articles, including the latest one
Module 3: “Notion / Update a Database Item”: it will allow you to update each article to include the link to the latest article.

If you run your scenario each time you add one article, you won’t need to add any logic between Module 1 and Module 2. But I would recommend to implement it. The goal is to group all articles in one array and then pick the one with the latest created date.

Everything here is theoretical; let me know if you need more details or an example.

Benjamin

1 Like

Hey Benjamin,
thank you so much, this works like charm!
I managed to have Make update the latest entry, linking every other entry to it. Awesome! :partying_face:
What I haven’t figured out yet, is how to delete everything before.

SO now I need to automate: let Notion find the 2nd youngest entry, and delete all linked entries in “-> 2”
How would I add that step?

Hey @Oscar3,

I’m super happy it worked!
I’m surprised it doesn’t replace the relation 1. Can you show me how you mapped it in Update a Database Item?

For the relation 2, can you try this?


It will force the Erase of the field

Benjamin

2 Likes

Awesome Benjamin, that really helped!
Now I’m basically all set up.

Still two things I need to figure out:

1. select all
I noticed the “select all” checkbox only selects the articles that exist on the time I set up the automation. How do I make it select all articles that exist, basically recalculating what is really there?


can i map that?

2. erase all - 2nd newst article
I don’t really seem to understand how to use the “watch database item”-module right. If I set the limit to 2, I still only get the newly created 1st article and none from before. It’s probably something easy that I don’t understand :grimacing:

1 Like

@Oscar3, it’s great that you manage to do what you wanted!

For your question 1, yes, in fact, it’s true that it will only let you select existing records the time you build the module. If you want this selection to be dynamic, it’s more complex, because you have to load all possible articles, and “aggregate” them into an array that contains all Ids, and then map the resulting array into the field (switching the little ‘map’ button On.
But may I ask you why you want to do this? Do you want the relation ‘2’ to contain a link to all other articles?

For your second question. All modules called “Watch xxxx” in Make (the ones you can only add at the beginning of a scenario) are special modules. They can keep track of the last items that you picked the last time you executed the scenario, and then pick only the new items that were created before the new execution of your scenario. This means that you only pick the new items, and not the older ones.
So for example, you have left the limit to 2. And you execute your scenario. Nothing is returned.
Then you add one Article in Notion
then you run the scenario again. It will find that since last time you executed, there is a new Article. It will pick this article.
And if you run again the scenario immediately after, it will not find any new articles.

Second example.
Now your scenario didn’t find any new article, you go to Notion and you add 3 articles
Then you run the scenario. The Watch module will see that there are 3 new articles. But since your limit is 2, it will only pick 2 articles, and leave the 3rd for next time.
If you run your scenario again, it will find the 3rd new article and will pick it.
If you run your scenario again, it will find no more article to pick.

I hope it clarifies it.

In your case, it’s a little bit tricky. As long as you run your scenario everytime you created a new article in Notion, it will pick this new article and update all Relation fields.
BUT, if you add more articles, it will pick all these articles (with the limit that you set). And will update every articles with each new article. Which means that you will make some useless updates, and if the latest article it picks is not the actual last article (in the case where the Notion API doen’t order Items by creation date), there is a risk that your other articles are not properly updated (because their Relation field will not point to the last article)…

So maybe, you can keep using Watch New Database Item for now, and later change it with a Search Database Item where you make a filter to always pick the Article with the Latest date.

I hope al this is clear

Benjamin

2 Likes

Hi Benjamin,

thank you for all those details! It’s very good to know about the limitations - I honestly had no clue! Then maybe we can skip the earasure for now and I’ll figure something else out.

What I would still like to try tho is the dynamic selection. If I manage to do what you suggest for my question 1, it would allow me to use the next/previous button. It’s functionality is mainly based on every article being linked through the ->2 property.
I’d be super grateful if you could walk me through the process of setting that up.

@Oscar3,

So, you want the relation 2 of all articles to have a link to all articles, right?

Ex: if you have Art1, Art2, Art3, Art4, then you want:

Art1

  • Rel1=Art1
  • Rel2=Art1, Art2, Art3, Art4

Art2

  • Rel1=Art1
  • Rel2=Art1, Art2, Art3, Art4

Art3

  • Rel1=Art1
  • Rel2=Art1, Art2, Art3, Art4

Art4

  • Rel1=Art1
  • Rel2=Art1, Art2, Art3, Art4

And if you create a new Art5:
Art1

  • Rel1=Art5
  • Rel2=Art1, Art2, Art3, Art4,Art5

Art2

  • Rel1=Art5
  • Rel2=Art1, Art2, Art3, Art4,Art5

Art3

  • Rel1=Art5
  • Rel2=Art1, Art2, Art3, Art4,Art5

Art4

  • Rel1=Art5
  • Rel2=Art1, Art2, Art3, Art4,Art5

Art5

  • Rel1=Art5
  • Rel2=Art1, Art2, Art3, Art4,Art5

Is that correct?

I tested and got this: is it what you want to achieve (note that my Article 4 has the relation 1 to all other articles because it’s bi-directional)

1 Like

Basically you’re right, I want every article to be connected to the newest article, so in your example that would be “article4” i suppose.
In my very first post you see that in ->1 every article relates to what would be your article4. And in ->2 it would only be filled for article4 with: article1, article2, article3, article4

And if a article5 would be created, it would also have the same:
it would have ->2: article1, article2, article3, article4, article5
Does it make sense?

@Oscar3 it took us a lot of messages, but finally now I think I get it completely :sweat_smile::joy:
the Rel1 has to contain the latest article everywhere
the Rel2 has to be cleaned for every articles, and the latest has to contain a relation to all the previous ones. Correct? :slight_smile:

this would look like this (Article 4 is the latest)

And, with Article 5 being the latest

If that’s correct, I can try and help you. It’s more complex because the current Modules won’t let you add multiple Relations at once; so you need to use “Make an API Call” and you have to build the array of IDs using an Aggregator and a Create Json modules.

Your scenario would look like this (my first module is “create a database item” I used for my tests, but you would have Watch Database Item instead

If you want me to help you on this, we will need to install the Make Dev Tool (here) in your Chrome browser to get an idea about the object names and the different paths, so that we can create the relevant Json document for your Relation 2.

You will find details and instructions for the Make Dev Tool here.

Let me know if you’re ok with this, and we’ll have a look together.

Benjamin

1 Like

Hi Benjamin,

thank you for your patience!
I installed the tool and followed the instructions. Ready to got!

One tiny thing still:
the relations property 1 & 2 are linked, so they influence each other.
Basically that means 2 shows what articles the newest article is linked to, and 1 links back from every article to the newest article.
This is achieved in the settings of the relation property by by using this switch:


(I’m sorry, no clue why I couldn’t change the interface language here, but maybe it’s still comprehensible)

@Oscar3 that’s interesting. I didn’t know what this option means.

When you update 1, it doesn’t automatically update 2?

Maybe I should try with this setting on in my tests before I make you change anything that would be useless :sweat_smile::sweat_smile:

Dear @Oscar3,

I added a two-way relation, with a new fields called Rel2. When I run the scenario, I don’t change anything in Rel2, and it seems to show what you want. In that case, there seems to be no need to do the complex part that involves “Make An API Call”

Can you have a look at the screenshot below and tell me if it’s what you want (don’t take care about the field ‘Related 2’

1 Like