# Creating email notifications each time a comment is added

**URL:** <https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561>\
**Category:** Ask for Help\
**Created:** [December 8, 2022, 3:05pm UTC](https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561 "2022-12-08T15:05:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saucy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/saucy/32/21556_2.png) [@saucy](https://community.glideapps.com/u/saucy)\
**Post date:** [December 8, 2022, 3:05pm UTC](https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561/1 "2022-12-08T15:05:35Z")

</div>

Hi All,

I’ve set up a DM function on my app using comments.

Each user can create a DM with another and exchange messages via comments. **This has been the easiest way for me to set up a DM.**

Here’s how it works:

1. User A clicks on a DM button on User B’s profile
2. An inline list appears creating a DM between User A and User B
3. In a Google sheet called “Chats” a row is added with the emails of User A (sender) and User B (receiver), as well as a unique Chat ID.
4. Once in the chat, User A and User B can comment (message) each other
5. A new row is added in the default Glide “Comments” Google sheet

Now for the problem:  
I set up a vlookup, pulling the Chat ID and from Comments and using that to find the recipient of the DM (comment).  
However, the vlookup only works when details are pre-populated. I.e. it doesn’t populate properly when new rows are added.

Does anyone have any tips?  
I’d like to set it up such that each time a new DM (comment) is added, the person the DM is intended for gets a notification that they have a DM.  
I have no problem setting up the email, but it’s the logic to get the email to the right person that’s tricky!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [December 9, 2022, 12:25am UTC](https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561/2 "2022-12-09T00:25:23Z")

</div>

> [@saucy](#):
>
> I’d like to set it up such that each time a new DM (comment) is added, the person the DM is intended for gets a notification that they have a DM.

Are you using an add row action or a form to create new “comments”? Or is it the “comments” component in Glide Apps?

---

<div class="post-metadata">

**Author:** ![saucy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/saucy/32/21556_2.png) [@saucy](https://community.glideapps.com/u/saucy)\
**Post date:** [December 10, 2022, 8:04pm UTC](https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561/3 "2022-12-10T20:04:15Z")

</div>

Comments component - that’s what I’m referring to by “default Glide Comments” sheet

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [December 11, 2022, 12:14am UTC](https://community.glideapps.com/t/creating-email-notifications-each-time-a-comment-is-added/55561/4 "2022-12-11T00:14:21Z")

</div>

> [@saucy](#):
>
> I set up a vlookup, pulling the Chat ID and from Comments and using that to find the recipient of the DM (comment).  
> However, the vlookup only works when details are pre-populated. I.e. it doesn’t populate properly when new rows are added.

Do you use a normal vlookup formula or have you looked at arrayformulas?

> [@Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727):
>
> Hi, Today I will show you the script that can make copying formulas down work, when it does not work with arrayformula. But first, let’s have some introductions about arrayformula, for those who has not used this before in Google Sheets, some equivalents in Glide and some good practices while using it. I hope it can help you in building your Glide apps as well as applying it in your normal day job. 
> 
> > **1/ Definition**
> >
> > Arrayformula is defined as “a range, mathematical expression using one cell range …
