👂 Feedback needed: scripts in automations that shouldn't be scripts

As a part of our focus on simplification, we are looking for use cases that are much more challenging to solve in Fibery than they should be.

Automation scripts are a natural suspect here: writing code requires effort, dedicated skills, and Admin rights (unlike no-code automations).

A question to you: what are the scenarios you consider basic and currently have to solve with scripts?

Please share your use case alongside your code. If you used to accomplish the same thing but without coding in another tool, include this part as well :slight_smile:

We’ll see if we can turn some of these scripts into no-code actions. The scripts are here to stay but we believe they should be reserved for advanced use cases.

2 Likes

Sending notifications in Telegram.

2 Likes
  • Set entity as recurring
  • Allow for intervals of a year for automated actions. For example: on schedule, delete an entity where the modification date is before one year ago.

Edit for clarity: I’m referring to the filter function according to an entity’s date field, not to the frequency of an automation that is on schedule.

Here’s an idea out of left field.
Enable xTalk style scripting as a low-code alternative: a simple high-level domain-specific language.
A recent example from the web world is HyperScript.

That’s an idea that’s had non-coders successfully scripting since the late 80s.

This was way more difficult that it should be:

2 Likes

Here are the automations I have that rely on scripts

Word Count

Fibery already has the .length() method but this is counting characters. My automation has a regex pattern and then updates a number input with the word count whenever the rich text field is edited.

There was a feature request for this a while ago which mentioned that eventually the rich text field could handle tracking and displaying the word count. This has done the trick for now.

Use case: Word count helps me find entities that have more “weight” than others. If one entity has 100 words and another has 400 words, that’s a quick signal that more thought has been put into the entity.

Markdown task count (total, complete, and incomplete)

When I’m doing a rough outline of steps/tasks to complete I prefer to use bullets or markdown tasks to capture all the steps. Sometimes they’re simple enough that it doesn’t warrant creating a task entity.

But the issue is there’s no way to know what entities contain markdown tasks. So I have another regex pattern that looks for markdown tasks and then updates number inputs for complete/incomplete tasks.

Use case: I can run the automation as a bulk action and find all the entities that may have markdown tasks. Then I can triage as necessary: mark as complete, delete, or convert into a task entity.

Word count feels like something that should be built in. Tracking markdown tasks was a simple copy/paste of code but I can see how modifying it would still be a steep curve for non devs.

3 Likes

This would be great.

3 posts were split to a new topic: Whiteboard-like Automations Setup/Builder

Joining Rich Text Field contents. E.g., I currently have a Feedback entity, which gets created when a new Slack Message comes in. Then for each new threaded message in Slack, I iterate through the thread and combine it into a single Rich Text Field in the Feedback.

Which I could just Feedback.[Slack Message].Replies.Join(Text, ‘\n’) in a formula.

1 Like

One place I struggle is trying to work with information across my entire workspace. There’s no way to work with an entity unless it is already in a relations field or by using scripting.

A simple example is that I have a Day database and for each day I want to auto connect three random entities from my Food database that have the field Baby = true. So each day, each meal, I want to have three foods to prepare for my baby that I know she has eaten before. So I have the do the following script 3 times (for each meal):

This should not be this hard. I wasn’t able to create this script without coming here to the forums. Coda is way way way better at dealing with data across the whole workspace. I can just reference any view that I want to and use random. Easy.

Another example is passing the AI custom queries and such that I talked about here (Best way to pass dynamic queries/views/info to AI?). Again Coda is FANTASTIC for stuff like this. Just create the view I want and reference it anywhere with a formula. Please please add this. Tana does this perfectly too.

Really I don’t feel like I should be forced to use scripting unless I’m doing something extremely complicated or working with data outside of fibery. But really Coda does these things better than Fibery without scripting.

6 Likes

When you say Coda, are you talking about https://coda.io?

1 Like

Yes, that’s correct.

One thing that I’ve found many potential use cases for (but am unable to do at all) is to loop over a Collection in an Automation and send the results of that to an Email / Notification / Slack integration.

For example, I’d like to run an automation every morning that looks at all tasks that are currently past due, and send a single email / notification / etc with the contents of that automation. It’s POSSIBLE to do this, but it requires sending a separate email for each past due Task. This could be extrapolated to many other use-cases I’m sure.

Better handling of collections in automations would be top of my wish list, as this solves many current friction points for my team.

3 Likes

Some unnecessarily complex scripts have been:

1. Post to Slack with a link to entity:

{!Public-id!}
<% const utils = context.getService(`utils`); %>

📜 New post by {{Created By.Name}}: *<<%= utils.getEntityUrl(Entity.Type, Entity["Public-id"]) %>|{{Name}}>*

Would be nice if the whole thing can just be compiled with Markdown. Also, the formatting of dates and date ranges is still very unclear.

2. Setting icon, states and emojis if formula:

I don’t have a script but I do think remembering that both of this is not possible

Thanks :slightly_smiling_face:

2 Likes

With respect to your baby foods example @Sarah_Arminta I think the issue is not with being able to query an entire database in an automation (which is actually possible) but rather the generation of random numbers (which isn’t possible with formulas)


1. Trim blanks from field when field is updated

const fibery = context.getService('fibery')
for (const entity of args.currentEntities) {
    const newName = entity.name.trim()
    if (newName !== entity.Name)
        await fibery.updateEntity(entity.type, entity.id, { Name: newName })
}

2. Create an auto-linked entity

When a new entity is created and it has a one-to-one relation to a 2nd DB, which is AUTO-LINKED by PUBLIC ID, it should be simple to create and link the other entity.

// Create and link the associated Page Workflow
const PAGE_WORKFLOW_TYPE = 'Projects/Page Workflow'
const fibery = context.getService('fibery')
for (const entity of args.currentEntities) {
    await fibery.createEntity(PAGE_WORKFLOW_TYPE, { 'Page ID': entity['Public ID'] })   // Auto-linked
}

3. Transcluding fields from other entities (i.e., JOINs)
Currently Lookups are read-only; If you want a “2-way Lookup” field, it requires scripting.

2 Likes

Useful?

Definitely see the need. But I know it might be challenging, if for example the auto-linking is based on a calculated/read-only field.
Either the UI has to block users from creating new entities, or let them create a new entity, but with the potential that it might immediately be unlinked.

Yeah, there is loads of cool stuff that can be done with transclusion. Just wondering how (if) you make use of scripting to achieve it at the moment?

I have not actually done this, but assume it could be done by creating a “mirror field” of the foreign field (in a 1:1 linked entity of a different DB). Both entities would need a Rule triggered by an update of their own field, which would then update the “foreign” linked entity’s mirrored field.

A script would probably be necessary to avoid feedback, unless Fibery is smart enough to not-trigger an Update rule when the new field value is the same as the existing value – or maybe a rule filter can prevent that?

But this is a whole lot of work (and a maintenance nightmare) just to create a single two-way Lookup.

This is more of my wishlist for formulas in general instead of just ones that currently require scripts, but there’s definitely a lot of overlap:

  • Formulas within automation filters! Would unlock so much more power and minimize many complex workarounds for things.

  • There’s no way to loop through multiple matching entities in automation without a script. Any attempt to do so with formula fields gets flagged as an infinite loop, even with very clear and restrictive filters in place.

  • There’s no way to do multiple/splitting paths (IF statements) in automations without a script.

  • There’s no way to do auto-links with any other condition besides EQUALS, which means we often need to rely on scripts to link related entities for CONTAINS/IS ONE OF scenarios.

  • “Union” function (essentially the existing “Join” function, only with references to entities instead of just a text field)

  • “ToNumber” function** (the opposite of the existing “ToText” function)

  • When using the “Link entity” action in automations, you can use a formula, but when you use the “Unlink entity” action, you cannot use formulas.

  • There is a “User Input” option for button automations, but not for rule automations.

6 Likes