I’ve created a button named “Deactivate” to deactivate someone from my team when this person leaves the project. This button do some updates of some fields:
There is this relation field called Tarefas (Tasks) that I wanted to be cleared but, with a condition. I wanted to clear only the Tarefas (Tasks) which the field Situação (Status) would not be Feita (Done) or Cancelada (Cancelled).
How can I make a formula with a condition to clear the field value. Is it possible?
But I want to clear the field, that’s the action. So I would have to write it right?
Summing up: I want the automation to disconnect (clear the field) from the user all the tasks that, in that moment, don’t have a status field which are Done or Cancelled.
Something like:
CLEAR THE [Step 1 User].Tarefas IF [Step 1 User].Tarefas.Filter(Situação.Name != “Feita” and Situação.Name != “Cancelada”)…
Think of it like you don’t need to explicitly clear the field of the things you don’t want, but rather you overwrite (=update) the field to be the things you do want, based on the opposite filter (which in some cases might just give nothing).
So if you want to get rid of Tasks which are not Done and not Cancelled, that means you want to keep Tasks which are either Done or Cancelled, if there are any.
i.e. you update the field with
[Step 1 User].Tarefas.Filter(Situação.Name = "Feita" or Situação.Name = "Cancelada")