I would like to pick someones brain for writing a script, unfortunately I can’t.
I have a readwise integration. In this readwise integration I have a database called Resources and a database called Highlights.
In the case of a book a Resource contains many highlights (sometimes over 250). For this I want to create 1 note to which all Text (= a Rich text field) from the Highlights will be added. This way I basicly create a Summary.
What I need is a button which triggers a script in the Resource database. I want to accomplisch this in 1 script, but for a clear explanation I have explained it in two parts.
Part 1
After clicking the button, a new entity in the database Notitie needs to be created.
The following fields should be filled in with information from the source
Resource = Linked resource
Name = Resource name
Bron - persoon = Resource Bron - persoon
Tag = Resource tag
URL = Resource URL
Part 2
A Resource is linked to many Highlights entities and these highlights contains a Richt text field called Text
Notitie also has a Rich text field, called Omschrijving
I want to add Text from Hightlight to Omschrijving in the created Notitie
Important in this is the order in which Text from Highlight should be placed in Omschrijving of Notitie. This should be based on creation date. Otherwise, the order of my text makes no sense.
I hope there is someone who can help me with this.
In the first action, I have set the name of the new Notitie based on the Resource name. You 'll need to add extra field settings to take care of what you have listed in Part 1.
I believe there is a small error in the script. I have changed the space where Notitie is in (DB second brain). But I get the following message in Fibery.
Failed to execute Action “Script”: Cannot read property ‘Id’ of undefined
We have adjusted your script slightly. We found out that creation date is not the correct field to determine the order of the highlights, but Location is!
Location is the place of the highlight in your book. Due to location, the order of the highlights always remains correct. Even if you go back to the beginning and create new highlights!
So here is the updated script for everyone who is looking for the same solution.