Hello FDM Gurus,
I have been trying to write a script to set email notifications when the FDMEE Process fails on Validate stage. I have tried to recreate my script as much as possible, however I am unable to find out is wrong with the script. The FDMEE Admin guide Email notification script is not correct as most of the APIs mentioned are from FDM and not for FDMEE. Request you kindly check the below script and point out what is wrong.
I have set the below script within the AftValidate Event. I am not sure if I should not be setting under the event scripts.
I am currently getting an error "Invalid procedure call or argument: 'objFDMAPI.API.MaintenanceMgr.fProcessStatus'".
My script:
'************************************************************************************
'REVIEW INPUT PARAMETERS
'************************************************************************************
If WScript.Arguments.Count <> 5 Then
WScript.Echo "You must supply 5 runtime variables." & vbNewLine & "Usage:HFM_LOAD.vbs LoadID CSS_Token OracleInstancePath JavaHomePath OLE_DB_PROVIDER"
WSCript.Quit -1
Else
LoadID = WScript.Arguments.Item(0)
CSSToken = WScript.Arguments.Item(1)
OracleInstancePath = WScript.Arguments.Item(2)
JavaHomePath = WScript.Arguments.Item(3)
Provider = WScript.Arguments.Item(4)
End If
'************************************************************************************
'Initialize FDMEE VB API
'************************************************************************************
Set objFDMAPI = CreateObject("fdmapi.clsAppServerDM")
WScript.Echo "FDMEE VB API created."
blnInit = objFDMAPI.fInitializeMainAPI(CStr(LoadID), CStr(CSSToken), CStr(OracleInstancePath), CStr(JavaHomePath), CStr(Provider))
If blnInit Then
WScript.Echo "FDMEE VB API initialized."
Else
WScript.Quit -1
WScript.Echo "fInitializeMainAPI failed."
End If
WScript.Echo CBool(True)
'************************************************************************************
Dim objProcessStatus
Dim lngStateCheck
Dim strFromAddress
Dim strToAddress
Dim strSubject
Dim strEmailMsgLine
Dim objMsg
Dim objConfig
Dim intSendUsing
Dim strSMTPServer
Dim intSendPort
'Message Content Variables
strToAddress = "abc@xyz.com;eve@xyz.com"
strFromAddress = "abc@xyz.com"
strSubject = "FDMEE Validation Failed"
strEmailMSGLine = "Validation Failed - Check FDMEE Process Log Details for -"
'Check for Location
If objFDMAPI.API.State.LocName = "United States" Or objFDMAPI.API.State.LocName = "Canada" Or objFDMAPI.API.State.LocName = "Mexico" Then
strLoc = objFDMAPI.API.State.LocName
'Initialize Process State
'lngStateCheck = 12 'Validation Failed
'Check Status of LoadID
Set objProcessStatus= objFDMAPI.API.MaintenanceMgr.fProcessStatus(objFDMAPI.API.State.LocName, objFDMAPI.API.State.CatName, objFDMAPI.API.State.Period)
If objProcessStatus.blnTBVal = false Then
strSubject = strSubject & strLoc
strEmailMSGLine = strEmailMSGLine & strLoc
strSMTPServer = "mail.abc.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
.Update
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 & strLoc
.TextBody = strEmailMsgLine & strLoc
.Send
End With
Else
WScript.Echo "Validation Success"
End If
'End With
End If
'Destroy message objects
Set objMsg = Nothing
Set objConfig = Nothing
objFDMAPI.Dispose
Set objFDMAPI = Nothing
I am able to receive email notifications without the APIs. Request you to kindly help and provide me guidance. Thanks in advance
Vikram