cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Email Notification For Query Created

Highlighted
Regular Member

Email Notification For Query Created

Hi,

I have created a user defined query.Can send query output via email to group of people using integrity OR schedule a email notification for query output?

Regards,

Rushikesh

3 REPLIES 3
Highlighted

Re: Email Notification For Query Created

Hello Rushikesh,

I see two options for you:

a) you hire a developer who creates a new scheduled Trigger for you. The Trigger reads the query results and sends out an email to the group

b) you use RSS feeds instead.

for a)

you can use the eMailAdvance.js as base. The developer "just" has to add the query functionality you asked for. And he needs to adopt the layout accordingly.

for b)

this RSS is already part of the Integrity ALM solution.

It consist of

- Trigger: Run RSS Report - New Defects

- Report: New Defects - RSS

Once generated, the result can be accessed with the link http://<server>:7001/rss/newDefects.rss

You need to have a RSS reader (usually a browser plug in). Depending on the plugin functionality you can also configure the reader to send out an email.

I suggest to give a try with RSS. Then you don't need any developer, just an Integrity administrator.

RSS.PNG

Hope this helps!

In case of questions, just let me know.

Volker

Highlighted

Re: Email Notification For Query Created

Volker,

One problem with the eMailAdvanced.js script.  It sends one email per item.  So if your query returns 50 items the email recipients will receive 50 separate emails.

A while ago I created a script (with the help of this community) that summarizes the items into one email.  If someone can improve it please share it with us.

Sample script below:

// <b>Integrity Manager Scheduled Trigger for [Your Title]</b>
// <p>
// This script is used to send mail notification from a scheduled trigger.
// Each issue that the trigger's query matches is summarized in one line,
// and is emailed to the appropriate recipient.
// If the query matches nothing, no email is sent.
// <p>use a <b>comma</b> to separate email addresses.
//
// @param String Email Address
// The email address is required, or we don't know who to send email to.
//
// param String Subject
// The subject is optional, the default subject is ``Scheduled Notification''.
//
// @param MultiString Start of message
// The message start is optional.
//

var eb = bsf.lookupBean("siEnvironmentBean");

if (eb.getEventContext() != "Schedule")
    eb.abortScript("The imens_multiple_email.js script may only be run from a scheduled trigger", true);

// Lookup the parameters bean, and from it find our three parameters,
// the recipient, the subject, and the message start.
var params = bsf.lookupBean("parametersBean");
if (params == null)
    eb.abortScript("Missing parameters bean", true);

var emailAddresses = params.getParameter("Email Address");
emails = emailAddresses.split(",");
if (emails[0] == null)
    eb.abortScript("This script requires an email address to email to!", true);

// Find the arguments bean, this allows us to find all the issues that
// were matched by the query which triggered us.
var args = bsf.lookupBean("imScheduleTriggerArgumentsBean");
if (args == null)
    eb.abortScript("Missing schedule trigger arguments bean", true);

var msg = params.getParameter("Start of message");
if (msg == null || msg.length() == 0)
    msg = args.getTriggerName()
        + "\n"
        + "YOUR MESSAGE HERE:"
        + "\n";

// var subject = params.getParameter("Subject");
// if (subject == null || subject.length() == 0)
    subject = "YOUR SUBJECT HERE";

var issues = args.getIssues();
if (issues.length != 0) {

    // Find the server bean, this allows us to lookup an arbitrary issue
    var server = bsf.lookupBean("imServerBean");

    // Iterate over all the issues, summarizing them and appending them to
    // the email message.
    for (var i = 0; i < issues.length; i++) {
        var issue = server.getIssueBean(issues[i]);
            msg +="\n"
            +"---------------------------------------------"
            + "\n"
            + "Display Name:       "
            + Field Name[i]
            + "  "
            + "\n"
            + "Field Name: "
            + issue.getFieldValue("Field Name")
            + "\n"
            + "State:          "
            + issue.getFieldValue("State")
            + "\n"
            + "URL:            "
            + "http://%host%:%port%/im/viewissue?selection="
            + issue.getIssueID()
            + "\n";
    }

    // Actually send the email.
    for (var i = 0; i < emails.length; i++) {
    eb.sendMail("Your_From_email_address", emails[i], subject, msg);
    }
}

Highlighted

Re: Email Notification For Query Created

Hi Daniel,

thanks a lot, looks really good!

We should have a knowlege database somewhere for the community. You all have great ideas and - in this case - solutions already.

Br, Volker

Announcements