Add User who triggered on People field

Hello,

I have a colleague who loves his “Pin” checkbox on our Tasks DB. The issue is that every time he use it, the other Assignees are notified. So I’m looking for a better manner to have a checkbox for personal usage without notification.

Currently, I tried several ways but I’m always facing limitations. So my last chance is using some code but I’m not familiar with it.

The “Pin” automation works but not the “Unpin” as I cannot remove only the User who clicked on the button from the People field.

Pin (works as I can add only the User who clicked)

Unpin (don’t works as I can’t remove only the User who clicked)

I would like to create 1 button that every time a User click on it :

  1. he is added on a People field (in Case the User isn’t already on the field)
  2. he is removed of the People field (in Case the User is already on the field)

It will permit to simulate an individual checkbox that everyone can Use without being notified.

Can you help me with the code ?

Out of curiosity, what is the eventual goal with this?
When someone chooses to add/remove themselves to/from the Pin list, what are the downstream effects you are aiming for?

My colleague pin the tasks to temporarily show them on a specific list.

It is possible to replace the checkbox with a Tag but we want a 1-click solution (as for a checkbox) that can works individually for everyone.

2 things:

  1. You probably don’t want to use the “Update Fields” action, and use the “Link” (In this case, “Assign People”) action to link the user. Update overwrites and doesn’t add the user.
  2. The Unlink action (Unassign) is much worse than the Linking action. See here: Unlink Automations to Reference Earlier Steps. Instead, you could update field and use a formula. Something like this: [Step 1 Database].Pin.Filter([Public Id] != [User who clicked Button].[Public Id])
2 Likes

Thanks for the tip.

I’m not sur if we are talking about the same context. Currently, I’m not able to use your formula :

Did I miss something ?

In all the cases, this will not permits me to use a single button.

I think @RonMakesSystems and I assumed that Pin was a collection of Users (representing all users who had pressed the ‘Pin’ button). If not, what is it?

2 Likes

Sorry, my bad. I didn’t checked “Allow multiple people” on the field. So yes, it is a collection of Users and now the formula works.

My two buttons works now, many thanks for your help !

Can we expect improvements in automation that allow us to easily manage these kinds of cases and use only a single button?

1 Like

Found a way!

  1. In the user database, as a formula field called “Tasks joined”. Tasks.Join(“{”+[Public Id]+“}”,“”)
  2. Use the “Update” action in the automation with the following automation:
If(
  Find(
    [User who clicked Button].[Tasks Joined],
    "{" + [Step 1 Task].[Public Id] + "}"
  ) = 0,
  [Users].Filter(
    Find(
      [Tasks Joined],
      "{" + [Step 1 Task].[Public Id] + "}"
    ) != 0 or [Public Id] = [User who clicked Button].[Public Id]
  ),
  [Users].Filter(
    Find(
      [Tasks Joined],
      "{" + [Step 1 Database 1].[Public Id] + "}"
    ) != 0 and [Public Id] != [User who clicked Button].[Public Id]
  )
)

This checks if the user is already part of it, adds them if not, and removes them if they are. All without any scripting.

2 Likes

Mmm, I see the logic, it’s interesting but it does not seems to work for me.

If I add a different User on People field and then I press the button, the previously added User is removed and the field is populated with myself.

If I press the button to remove myself, nothing happen. And if the People field contains another User, the other User is removed but not myself.

Not sure what we’re doing differently… Tested it on my end and it works. Wanna send some screenshots?

Ok… I found the issue. There is a bug on Fibery when importing templates.

At the beginning we created come Spaces for different Users and on several of this Spaces, we imported the Project Management template. It seems that Fibery doesn’t rename the DB names if one already exists with the same name when importing a template. So on my User Fields, there were several relations to different Tasks DB’s with the same name ! When I copied your formula to my field Tasks Joined, it pointed out to the wrong Task DB.

I renamed all the Tasks relations to clearly identify which Task DB I was using on my formula and now it works !! :star_struck:

Many thanks for your help, I learned something today !

1 Like