Conditional Trigger Formula?

Hi, I want to add a conditional trigger formula where I can get the updated time and user name only when certain users updated field. I created a normal trigger formula names $Updated by then created another collumn with the following formula but it results all user name regardless of who updates the field. can any one help me?
if $Updated_by == “User 1 name” or “User2 name”:
return user.Name

Your condition if $Updated_by == "User 1 name" or "User2 name" means: if ($Updated_by is equal to “User 1 name”) or (“User2 name” is true). "User2 name" being a non-empty string, it’s always true. You mean:

if $Updated_by in ("User 1 name", "User2 name"):
  return user.Name
1 Like

Thanks. i will try that. Is there any direct way to get what i want here. I mean without making the updated by collumm in the first place?

Doesn’t this work?

if user.Name in ("User 1 name", "User2 name"):
  return user.Name

Or this one-liner (to leave the value unchanged if user.Name isn’t in the list):

return user.Name in ("User 1 name", "User2 name") and user.Name or value
1 Like

Thank you very much brother. It worked and I learnt the idea. Now i applied to get the updated time as well.