3 Replies Latest reply: May 1, 2012 11:11 AM by Pippy G RSS

    FDM Load Mail Notification

    Pippy G
      Hi Experts:

      I have the following script which I put together from the send mail accelerators, which I applied to the "AftLoad" event script. However when I manually go through and upload data successfully I still receive the "failed" part of my notification email. I'm not sure where I'm going wrong so any help would be appreciated.

      Thank you


      Please see script below:

      Sub AftLoad(strLoc, strCat, strPer, strTCat, strTPer, strFile)
      'Hyperion FDM EVENT Script:
      'Created By:      pgill
      'Date Created:      2012-05-01-14:21:07

      'Declare local variables
      Dim strFromAddress
      Dim strToAddress
      Dim strSubject
      Dim strEmailMsgLine
      Dim objMsg
      Dim objConfig
      Dim intSendUsing
      Dim strSMTPServer
      Dim intSendPort
      Dim lngStateload

      'Initialize message content variables
      strFromAddress = DW.Security.fUserEmailGet(DW.Connection.PstrUserID)
      strToAddress = "Peramdeep.Gill@westfield-uk.com"
      strSubject = "Hyperion FDM Processing Status"

      'Initialize Process State
      lngStateload = "31" 'Load Ok

      'With API.MaintenanceMgr.fProcessStatus(strLoc, strCat, strPer)
      With API.MaintenanceMgr.fProcessStatus(API.POVMgr.PPOVLocation, API.POVMgr.PPOVCategory, API.POVMgr.PPOVPeriod)
      If .lngStatus = lngStateload Then
      'Load step successful
      strSubject = "FDM: Extract Load Successful!"

      strEmailMsgLine = "<b><u>Data Load Status</b></u>" & "<br><br>" &_
                "Data load has been <b><font color=green><u>successful</b></font></u> for the following Point-Of-View:" & "<br><br>" &_
                "<li>&nbspLocation "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVLocation & "<br>" &_
                "<li>&nbspScenario "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVCategory & "<br>" &_
                "<li>&nbspPeriod "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVPeriod & "<br>" &_
                "<li>&nbspLoad Time "& "&nbsp»&nbsp&nbsp" & Date & " - " & Time           
      'Load step failed
      strSubject = "FDM: Extract Load Failed!"

      strEmailMsgLine = "<b><u>Data Load Status</b></u>" & "<br><br>" &_
                "Data load has <b><font color=red><u>failed</b></font></u> for the following Point-Of-View:" & "<br><br>" &_
                "<li>&nbspLocation "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVLocation & "<br>" &_
                "<li>&nbspScenario "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVCategory & "<br>" &_
                "<li>&nbspPeriod "& "&nbsp»&nbsp&nbsp" & API.POVMgr.PPOVPeriod & "<br>" &_
                "<li>&nbspLoad Time "& "&nbsp»&nbsp&nbsp" & Date & " - " & Time & "<br><br>" &_
                "<i><font color=Gray>***Please contact Hyperion System Administration For failure resolution***</i></font>"

      End If
      End With

      'Initialize Mail Server variables
      'SMTP server name
      strSMTPServer = "lonmail"
      '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
           .Subject = strSubject & " - " & Date & " - " & Time
           .HTMLBody = strEmailMsgLine
      End With

      End Sub
        • 1. Re: FDM Load Mail Notification
          This line is obviously not evaluating to true

          If .lngStatus = lngStateload Then

          Output the value of .lngStatus to the FDM information bar or the logs and see what it evaluating to and if a valid value whether this changes on success failure.
          • 2. Re: FDM Load Mail Notification
            Since it is VBSCript and everything is a data type Variant anyway, this shouldn't matter but ...

            'Initialize Process State
            lngStateload = "31" 'Load Ok

            ^ You just made a string.


            ^ Most likely returning numeric

            Anyway, if the numeric value is 31 and the string is 31, VBScript should equate that to being equal.

            For entertainment value; however, why not put the .lngStatus code in the email so you can verify the value you are getting back from FDM? Perhaps you got the wrong number for LoadOK?

            Also, aren't there constants for those values? If there are, I would use those to make sure your script doesn't break in a future release if they change the value associated to Load OK.
            • 3. Re: FDM Load Mail Notification
              Pippy G
              Hi Guys,

              Thank you for your help.

              Before I went to check the .lngState value your feedback triggered me to look at the "31", I hadn't realised I had put the status code in "". Upon removing, the email alert was successfull.

              Thank you for your very quick help.