Notify a user about a comment to their message in the feed
Create the following business process: when adding a new comment to the message in the feed, an email is sent to the author of this message.
Business process diagram (Fig. 1) elements:
-
Incoming signal for adding a message comment – when a new comment is added, the signal is activated and the business process is started.
-
Reading the Id of the added comment – reading the new comment data for use in the email template.
-
Reading the parent message - reading the data of the main message for use in the email template.
-
Sending email – an email to a contact with the selected text and new comment data.
To do this:
-
Place on the schema the Signal element of the Initial events group — "Comment added". The element will be activated when a comment is added to the feed.
-
Set up the signal parameters (Fig. 2).
- In the Object field, set "Message/comment".
- In the What event should happen? field, select "Add record".
- In the Added record must correspond to conditions field, select "Parent message populated.
-
Add two Read data elements of the System actions group.
-
The "Read comment data" element will read data from the added record in the feed. Set up the element parameters (Fig. 3).
-
In the Which data read mode to use? field, select "Read the first record in the selection."
-
In the Which object to read data from? field, select "Message/comment."
-
In the How to filter records? area, set the filter "Id = Comment added. Unique record Id." To do this, click
<Add condition>
, select the "Id" column, then in the appeared menu, select Compare with parameter. In the opened window, select the Record ID parameter of the "Comment added" element. -
In the Which column values to read?, select "All columns".
-
-
The "Read primary message" element will read data of the message to which a comment has been left. Set up the element parameters (Fig. 4).
-
In the Which data read mode to use? field, select "Read the first record in the selection."
-
In the Which object to read data from? field, select "Message/comment."
-
In the How to filter records area, set up filter "id = Read comment data.First element of the resulting collection.Parent message". To do this, click
<Add condition>
, select the "Id" column, then in the appeared menu, select Compare with parameter. In the opened window, select the Parent message parameter of the "read comment data" element. -
In the Which column values to read?, select "All columns".
-
-
-
Add the "Send e-mail" element of the System actions group and set the following parameters (Fig. 5):
-
In the From field, specify the return address in the message. To do this, select Select from lookup in the parameter value menu, then in the Synchronization with mailbox settings lookup, select one of the configured email accounts.
-
In the To field, specify the email of the recipient. In the parameter value menu, click the Contact → Process parameter, select the Read contact data element, and the Email parameter.
-
In the What is the message? field select "Template message."
-
Select the existing template in the Template message field. The Subject field is populated automatically.
-
Select "Send email automatically" in the How is the message sent? field.
-
-
After creating the process elements, connect each element with the next one by dragging the element in the upper right corner of the selected process element.
-
Save the created business process.
As a result of the new business process, when adding a new comment to the message in the feed, an email is sent to the author of this message.