4 Replies Latest reply on Mar 10, 2015 1:20 AM by Francisco Amores

    FDM Classic Email Notification


      I hope somebody can help me resolve an email notification issue.  Using the FDM accelerators, I generated the send mail script and appended it to the AftExportToDat event.  The email generates but it continuously sends the email nonstop for one load event. Can anybody assist?



        • 1. Re: FDM Classic Email Notification

          In trying to troubleshoot the issue, I discontinued sending the email and just limited to publishing the PDF report in the ProcessReport folder.  I observed that the PDF report is being regenerated (having a more recent file create date and time).  It appears that a process is in an endless loop?

          • 2. Re: FDM Classic Email Notification

            Can you paste the code you have in your Event Script please?

            • 3. Re: FDM Classic Email Notification

              As I was trying to address the problem I posted above, I decided to revert back to the original problem that I was having.  I have an inherited Batch load script that does the load, publish the process report, and sends the email.  The script works with 2 other FDM applications in the same environment. However, with the new FDM application I recently built, it continuously publishes a report and sends an email.


              Based on my testing, it looks like the .lngStatus value is always equal 31 and does not reset and thus the report is always being generated and resent.  I double/tripled check the configuration and integration settings and they appear correct.


              Can you help me figure out what is going on?  I am new with FDM.


              Thank you,



              Below is the script.


              Sub BatchLoad()


              'FDM CUSTOM Script:


              'Created By:        Hypadmin

              'Date Created:    2/12/2015 3:32:32 PM


              'Purpose:             Execute a Batch Loader task.




              'Execute a STANDARD batch



              'Use Serial Processing


              'Declare Local Variables

              Dim lngProcessLevel

              Dim strDelimiter

              Dim blnAutoMapCorrect

              Dim lngbatchID

              'Declare Local Variables for Report Publishing Parameters

              Dim objReport

              Dim lngReportID

              Dim lngPublishType

              Dim strPublishPath

              'Declare Local Variables for Email Notification

              Dim strFromAddress

              Dim strToAddress

              Dim strSubject

              Dim strEmailMsgLine

              Dim objMsg

              Dim objConfig

              Dim intSendUsing

              Dim strSMTPServer

              Dim intSendPort


              'Initialize Variables

              lngProcessLevel = 12 'Up-To-Check

              strDelimiter = "~"

              blnAutoMapCorrect = 0


              'Create the file collection

              Set BATCHENG.PcolFiles = BATCHENG.fFileCollectionCreate(CStr(strDelimiter))


              'Execute a Standard Serial batch

              1. BATCHENG.mFileCollectionProcess BATCHENG.PcolFiles, CLng(lngProcessLevel), , CBool(blnAutoMapCorrect)



              With API.MaintenanceMgr.fProcessStatus(API.POVMgr.PPOVLocation, API.POVMgr.PPOVCategory, API.POVMgr.PPOVPeriod)

                              If .lngStatus = 31 Then

                                              'Report Publishing - Active Reports                                          


                                              'Initialize Variables

                                              lngReportID = 112                            'Example (TB Current Location With Targets)                     

                                              lngPublishType = 31        'PDF 


                                              'Grab the PeriodKey

                                              strPer = Trim(CStr(RES.PdtePerKey))

                                              strPer2 = Left(strPer,2)



                                              DW.DBTools.mLogError 1, CStr(strPer), CStr(strPer2), Nothing



                                              'Convert Period to Correct Format for Report

                                              If Left(strPer,2) = "10" Or Left(strPer,2) = "11" Or Left(strPer,2) = "12" Then

                                                              strPer = Right(strPer,4) & Left(strPer,2) & Mid(strPer,4,2)


                                                              strPer = Right(strPer,4) & "0" & Left(strPer,1) & Mid(strPer,3,2)

                                              End If


                                              strPublishPath = API.DataWindow.Connection.PstrDirOutbox & "\" & "ProcessReport" & "\" & "IS Process Monitor Report" & "~" & API.POVMgr.PPOVCategory & "~" & API.POVMgr.PPOVPeriod & ".pdf"


                                              'Create the Report object

                                              Set objReport = CreateObject("upsWReportingDM.clsReportPublisher")           

                                              objReport.mInitialize API                                                    


                                              'Set Parameters


                                              objReport.mParametersAddNew "CatKey", "12"

                                              objReport.mParametersAddNew "StartPeriod", strPer                                                    

                                              objReport.mParametersAddNew "EndPeriod", strPer                            

                                              'Publish the Report

                                              objReport.mReportPublishToFile CLng(lngReportID), CStr(strPublishPath), CLng(lngPublishType)                                                         


                                              'Destroy the objects

                                              Set objReport = Nothing



                                              DW.DBTools.mLogError 1, CStr(strPer), CStr(.lngstatus), Nothing




                                              strFromAddress = "emailsource"

                                              strToAddress = "Receipient"

                                              strSubject = "Company Income Statement Cube - Process Monitor Report"



                                              DW.DBTools.mLogError 1, CStr(strFromAddress), CStr(strSubject), Nothing



                                              'Initialize Mail Server variables

                                              'SMTP server name

                                              strSMTPServer = "mail.company.com"

                                              'CdoSendUsing enumeration-1=use smtp on local machine, 2=use smtp over network

                                              intSendUsing = 2

                                              'SMTP port on server

                                              intSMTPPort = 25


                                              'Create CDO configuration object

                                              Set objConfig = CreateObject("CDO.Configuration")       

                                              'Set Config object settings

                                                              With objConfig.Fields

                                                                              .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = intSendUsing

                                                              .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer

                                                                              .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= intSMTPPort

                                                                              .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10


                                                              End With


                                              'Create CDO message object

                                              Set objMsg = CreateObject("CDO.Message")    

                                              'Assign config object to configuration property of message object

                                              Set objMsg.Configuration = objConfig

                                              'Set Message object settings and send mail

                                                              With objMsg


                                                                              .To = strToAddress

                                                                              .From = strFromAddress


                                                                              ' Sets the subject line of the mail message

                                                                              strSubject = "Company Income Statement Cube - Process Monitor Report"

                                                                              .Subject = strSubject


                                                                              ' Sets the message body of the email

                                                                              .TextBody = "Attached file:" & vbNewLine & strPublishPath


                                                                              ' Add .PDF file as an attachment

                                                                              .AddAttachment strPublishPath



                                                              End With


                                              'Destroy message objects

                                              Set objMsg = Nothing

                                              Set objConfig = Nothing                                                               

                              End If

              End With


              End Sub

              • 4. Re: FDM Classic Email Notification
                Francisco Amores

                I would suggest using BatchAction event script for that purpose.

                You can see in the API guide the different subevents.

                Then you can control if the batch was OK

                if you want to send email notification after each load you can also use AftLoad but bear in mind this event script is executed for each file being exported -A.dat, -B.dat, -C.dat... so you need to control in your code that you only send the email once.


                Hope that helps