Send an email to newly added user in Enum list column

I’m working on a bot in App Sheet that sends an email notification whenever the [user_material] column (which is of type EnumList) is updated.

Here’s the scenario:

When I first assign users (e.g., user1 and user2), an email goes to both — :white_check_mark: working as expected.

But when I add another user later (e.g., user3), the email is going again to all three users (user1, user2, and user3).

What I want is: the email should go only to the newly added users (like user3 in this case), not to the existing ones.

Right now, my bot trigger condition is:

[_THISROW_BEFORE].[user_material] <> [_THISROW_AFTER].[user_material]

And in the email “To” field, I used [user_material], which sends to all selected users.

Any better way or best practices for this?

Thanks in advance! :folded_hands:

In the “To” field, please try an expression of

[_THISROW_AFTER].[user_material] - [_THISROW_BEFORE].[user_material]

The above expression subtracts from the list of values that were before the change in the enumlist and after change. You may need to add additional conditions if the user can also remove a value from the earlier list.

You have given an example of User 1 and user 2 and then User 3 being added. If there can be a scenario wherein the list has User 1 and User 2 and the User 2 is removed, then you may need to add additional logic, possibly in the event trigger based on the business need of your app.

So if a user is removed from the list, then maybe you want the bot not to fire. So your triggering condition could be something like

AND([_THISROW_BEFORE].[user_material] <> [_THISROW_AFTER].[user_material],

[_THISROW_BEFORE].[user_material] < [_THISROW_AFTER].[user_material]

)

Alternatively, you could also test with a simpler trigger condition as follows for this requirement ( that the bot should fire only if the users are added , not otherwise.)

[_THISROW_BEFORE].[user_material] < [_THISROW_AFTER].[user_material]

This is just a trigger condition. It will just detect that change has taken place in one of the columns in the record, but this expression will not know what change has taken place.

1 Like

I tried with this; it is not working. Mail is going to user 1 & user 2 again

Could you detail it how you have implemented.

I have tested my suggestion before sharing and it works.

1 Like

[_THISROW_BEFORE].[user_material] <> [_THISROW_AFTER].[user_material]- This is the condition.

In process: for To I have tested with 2 conditions

1.[_thisrow_after].[user_material]

2.[_thisrow_after].[user_material]-[_thisrow_before].[user_material]

in the condition :

AND([_THISROW_BEFORE].[user_material] <> [_THISROW_AFTER].[user_material],

[_THISROW_BEFORE].[user_material] < [_THISROW_AFTER].[user_material]

)

I tested with this; it is getting error : Arithmetic expression ’ [_THISROW_BEFORE].[user_material] < [_THISROW_AFTER].[user_material]’ does not have valid input types

Yes, sorry about that. This less than (< ) condition will work only for numerical columns.

Please continue to use just ([_THISROW_BEFORE].[user_material] <> [_THISROW_AFTER].[user_material] for the bot trigger condition.

1 Like

Yeah, I wrote this condition. this is working fine. But I think I have to change the TO condition, Unable crack the logic for this.

For 'To" field, did you try as suggested?

[_THISROW_AFTER].[user_material] - [_THISROW_BEFORE].[user_material]

1 Like

I tried this, but it is not working

Okay, it worked for me. Maybe time to engage Support team.

1 Like

I have tried; I didn’t get any update from them

Please try another option

Please add a real column called say [previous_user_material] of enumlist type with base type as Email and app formula as [_THISROW_BEFORE].[user_material]

Then the “To” field of the bot can be something like

[user_material] - [previous_user_material]

1 Like