emailing automatically reports from ALM
Question ID: 107999

is there a way to email automatically reports from alm i know graphs can be shared from analysis view and that’s not my question my question is if i have reports i created in alm with queries how can i create a workflow script or ota api that grabs that report from alm and sends via email to users daily at a specified hour of the day in an automated fashion ? thanks

Marked as spam
Posted by (Questions: 19, Answers: 17)
Asked on November 1, 2017 2:53 pm
Answers (1)
Private answer

ALM OTA has a send email functionality which can be leveraged for sending emails, but I dont know if that can be scheduled in any way.

Below is the example from OTA API reference

Sub AttachFileAndMail()
' This example shows how to check if a defect has attachments,
' how to add attachments to a defect, and how to mail
' all the attachments of a given defect.

Dim attachFact As AttachmentFactory
Dim theAttachment As Attachment
Dim attachList As List
Dim BugFact As BugFactory
Dim theBug As Bug
Dim AttachmentList() As Variant
Dim HasAttachs As Boolean

On Error GoTo AttachFileAndMailErr
' Get an arbitrary defect for this example.
' To find a particular defect, use
' BugFactory.FindSimilarBugs or Bug.FindSimilarBugs.
'tdc is the global TDConnection object.
Set BugFact = tdc.BugFactory
Set theBug = BugFact.Item(1)
' Use Bug.Attachments to get the attachment
' factory for the defect.
Set attachFact = theBug.Attachments
' For demonstration purposes, print the
' names of existing attachments.
Set attachList = attachFact.NewList('''')
For Each theAttachment In attachList
Debug.Print ''The Attachment.FileName is '' _
& theAttachment.FileName
'For this example, guarantee that there are
' attachments to an email by attaching files if
' necessary.
'To run the example, ensure that your workstation has files:
' ''D:temperr.log'' and ''D:tempoutput.txt.''
HasAttachs = theBug.HasAttachment
If HasAttachs Then Debug.Print vbCrLf & ''----------------------------------''
If Not HasAttachs Then
Set theAttachment = attachFact.AddItem(Null)
theAttachment.FileName = ''C:temperr.log''
theAttachment.Type = TDATT_FILE
' Use AttachmentFactory.AddItem to create the new project entry.
Set theAttachment = attachFact.AddItem(Null)
theAttachment.FileName = ''C:tempoutput.txt''
theAttachment.Type = TDATT_FILE
End If
' Populate a variant array of server file names
' for use in the SendMail method.
Set attachList = attachFact.NewList('''')
'Count starts at one and Variant Array size
' starts at zero (but see Option Base in the Visual
' Basic help), so array size is Count minus one.
ReDim Preserve AttachmentList(attachList.Count - 1)

Dim i%
i = LBound(AttachmentList)
' Use Attachment.ServerFileName to specify the attachment.
For Each theAttachment In attachList
AttachmentList(i) = theAttachment.ServerFileName
i = i + 1
Debug.Print vbCrLf & ''----------------------------------''
' Array is populated. Let's see what we have:
Dim fName
For Each fName In AttachmentList
Debug.Print ''The AttachmentList element is '' & fName
' Use TDConnection.SendMail to
' send the attachments.
tdc.SendMail ''steves,alex_qc'', tdc.UserName, _
''TestMail TDConnection.SendMail with attachments'', _
''TDConnection.SendMail: This is a test'', AttachmentList

Exit Sub

ErrHandler err, ''AttachFileAndMail''

End Sub

also if you want to schedule it then you will have to either use task scheduler or softwares like jenkins which can execute code for you.

We had the same issue and to resolve it we have create a simple HTML website which can generate the reports at runti

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on October 5, 2018 5:23 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top