I’ve seen there’s a post with the theme: Scripts that should be Automations, or something like that. And I have one that I’m not sure if it’s already possible as an automation. Also, the AI script generator hasn’t been of much help…
I work on a project with volunteer workshifts. And each workshift adds a point to the persons profile. So, I have a WorkShifts database, an there is a relation field of Presents on that workshift.
I wanted to create a button that would add a point on the “Hours” number field of all the people (database) that are related on the relation field “Presents” of the workshift.
Every month, there is a rule that takes one point from Hours. So the person who hasn’t done any shift during that month, would be negative, and the system would put him on alert… So that’s why I need the button, I want to add each Hour after the person finishes the shift.
My point is, is it possible to update a field inside an entity from “inside” the a entity related to the first one?
In the automations, (no code) if the triggering entity has relations, you can select “Update {Linked entity}”. So the answer to the question is yes, you can make changes on related entities. The only problem is that you can’t set it to be +1 or -1 what it was before (without scripting a for loop), you can only update all them to be a specific number. Essentially it would be: for each related entity in the relation field, update the field value to be plus on what it already is. No way to do that with no script I think.
Is this rule already implemented? You can create another database called “Point cost” or something and link it to the volunteers. Then on the volunteers database you create an automation that runs every month that creates and links a “Point cost” with value “1”. Then the formula adds all the work, and minuses all the cost. You can even set in the formula to filter it by the last month to see recent points. I know it’s not what you asked for, but unless I’m missing something I think it makes more sense, and you don’t need to script this way. (which could get clunky if you ever decide to change field names).