Automate script to create template using data from another table

I am using the Daily Check-ins Template for our team to write in their progress notes. When a member creates a new daily note, I would like the rich text field (‘Notes’) to populate things from their day automatically, so that they can just fill in the rest as needed (click new, and the field is prefilled, like the name field does using a formula). In particular, I want the Notes field to have a list of events that occurred today for the user and list of tasks that were scheduled for them today and were marked done.

I’m trying to figure this out, but having trouble since I am not familiar with javascript.

Do you mean that you want to populate the Notes field with a record of their ‘activity’ in Fibery, e.g. updated Task A status, attended Meeting X, etc.?
At the moment, the activity log of an entity (or for a specific User) is not accessible in automations, even with a script.

If you meant that you just want to pre-fill with a template, e.g.

**Today's events:**
___
fill in here

**Tasks worked on:**
___
fill in here

then this is possible using markdown.

I don’t know if I need an activity log, I just want to call on a list of or just a view with a number of filters that will populate the rich text. So for the tasks example, I want a list view of Tasks which are assigned to me and are due today and are marked as done. And for events, a list view of events that have a date of today.

In that case, you can probably use the GraphQL API to make filtered queries of the respective databases.

I’d suggest playing around with formulating the ideal query(ies) and then put these in a script, which will generate the content with which you can populate the rich text field.

I’ll play around with these thanks

Oh boy, this is too difficult for me without coding experience. I’ve tried to add this code into an automation, but it doesn’t execute:

{
findTasks(
assignees: { contains: { id: { is: “$my-id” } } },
dueDate: { is: “$today” },
state: {name: {is: “Done” }}
) {
name
}
}

I have realised that there is probably an easier way to solve this, without needing any coding:

If you create a relation between the Check-In db and the Task db, you can then create an automation which will run when a Check-In is created and will populate this Tasks field (with only the Done Tasks that are due today) and then subsequently populate the Notes field with the names of these Tasks:

Note: the formula for update is as follows:
[Step 1 Check-in].[Created By].Tasks.Filter((State.Name = "Done") and ([Due Date] = Today()))

It will behave like this:
firefox_z6e9tCY5Gl

2 Likes

This is the way to do it, I love it, thanks so much!!!

1 Like