samnaction
samnaction

Reputation: 1254

How to suppress multiple email notification from javascript

Here is my java script

var siteGroup = "GROUP_EMAIL_CONTRIBUTORS";
var mail = actions.create("mail");
mail.parameters.to_many = siteGroup;
var url = "Click http://pc1:8080/share/page/site/" + document.properties.name + "/dashboard" + "   to join the site";
mail.parameters.subject="New Site Created in Community";
mail.parameters.text=url;
//execute action against a document
mail.execute(document);

The siteGroup has three members with three different email address. The problem is this java script is sending three email notification to all the three users. If I add one more member then each will get four email. How to suppress this?

enter image description here

enter image description here

Upvotes: 1

Views: 286

Answers (1)

Tahir Malik
Tahir Malik

Reputation: 6643

You need create a subtype of st:site to make sure it only triggers on the site.

There are 2 options:

  1. Change your email.js so it checks if the document type is st:site
  2. A better way is described here, were you can add the st:site as a sub-type in the share-config-custom.xml so it's selectable in the drop-down next to the default Folder & Content types

Example, this snippet needs to be between de alfresco-config tags:

<config evaluator="string-compare" condition="DocumentLibrary">
        <types>
             <type name="cm:folder">
                <subtype name="st:site" />
            </type> 
        </types>
    </config> 

Upvotes: 2

Related Questions