Activity feed e-mail notification content grouped by site

cancel
Showing results for 
Search instead for 
Did you mean: 
trmmnt
Active Member

Activity feed e-mail notification content grouped by site

Jump to solution

Hi,

having large amount of activities on a daily basis a user easily gets lost in the content of activity feed e-mail notificiation.

What is the best way to group individual activities by related Site?

Outline of how notification e-mail structure should look like:

Site 1 (heading)

User1 updated Document 1 in Site 1.

User1 deleted Document 2 in Site 1.

----

Site 2 (heading)

User1 updated Document 3 in Site 2.

User2 added Document 4 in Site 2.

Thank you for any useful information in advance.

D.

1 Solution

Accepted Solutions
jpotts
Professional

Re: Activity feed e-mail notification content grouped by site

Jump to solution

The email template that is used to produce that notification resides in the Data Dictionary under Email Templates/activities.

In that template, you can see where the list of activities is iterated over:

<#list activities as activity>


In that loop you can see where the site ID gets referenced:

${activity.siteNetwork?html}


So, if you want to iterate over the sites in the activities collection instead of just all of the activities, you can edit the template to iterate over the activities to build a list of site IDs, then you can iterate over that list to produce the site-specific groups.

If you need help, refer to the Freemarker reference:

Apache FreeMarker Manual 

Jeff

View solution in original post

4 Replies
jpotts
Professional

Re: Activity feed e-mail notification content grouped by site

Jump to solution

The email template that is used to produce that notification resides in the Data Dictionary under Email Templates/activities.

In that template, you can see where the list of activities is iterated over:

<#list activities as activity>


In that loop you can see where the site ID gets referenced:

${activity.siteNetwork?html}


So, if you want to iterate over the sites in the activities collection instead of just all of the activities, you can edit the template to iterate over the activities to build a list of site IDs, then you can iterate over that list to produce the site-specific groups.

If you need help, refer to the Freemarker reference:

Apache FreeMarker Manual 

Jeff

trmmnt
Active Member

Re: Activity feed e-mail notification content grouped by site

Jump to solution

Hi, Jeff.

Thank you. Yes, I am aware of the template file. I needed some kind of comfirmation that this is correct way to do it. Alternatively, I was wondering if there is a common way to override Activity Feed Notification logic that creates objects for the FTL to avoid juggling with data in the template file.

But It would probably take less effort to modify just the presentation layer.

Best regards,

D.

jpotts
Professional

Re: Activity feed e-mail notification content grouped by site

Jump to solution

Oh yeah, I'd definitely just do this in the presentation layer. Much easier and I know it works.

upforsin
Senior Member

Re: Activity feed e-mail notification content grouped by site

Jump to solution

If someone were still interested, below is the implementation of Jeff's description

<#assign siteNetworks = []>
<#list activities as activity>
   <#if activity.siteNetwork??>
      <#if !siteNetworks?seq_contains(activity.siteNetwork)>
         <#assign siteNetworks = siteNetworks + [activity.siteNetwork]>
      </#if>
   </#if>
</#list>
<#list siteNetworks as siteNetwork>
   <div style="...">
      ${(siteTitles[siteNetwork]?html)!siteNetwork?html}
   </div>
   <#list activities as activity>
      <#if siteNetwork == activity.siteNetwork>
         ...
      </#if>
   </#list>
</#list>
howkymike
Alfresco Developer