1 Reply Latest reply on Oct 19, 2017 9:25 AM by JohnGoodwin

    Create A script to upload the data using EPM Automate Utility

    Moatasem Shebl

      Hello All,

       

      I have a script which i use it to upload my data from a flat file to my target EPM application using EPM automate utility i just want to add a part to it to send an email when the process complete successfully, i added the email part but it gives me unknown error but in the part related  to EPM automate command its working correct, please help me in the email part of that script

       

      @echo off

       

      SET url=https://My instance.com

      SET user=My user

      SET domain=XXXX

      SET importpath=inbox/ERP_Data

      SET importfile=inbox/ERP_Data/TEST.CSV

      SET dataimportfilename="C:\Work\Test.CSV"

      SET password="C:\mySecuredir\password.epw"

       

      SET /A ERROR_LOGIN=100

      SET /A ERROR_CLEAR_DATA=200

      SET /A ERROR_MAIN_PUSH_CLEAR=250

      SET /A ERROR_DELETE_FILE=300

      SET /A ERROR_UPLOAD_FILE=400

      SET /A ERROR_RUN_DATA=500

      SET /A ERROR_REFRESH_CUBE=600

      SET /A ERROR_CALC_DB=700

      SET /A ERROR_MAIN_PUSH=800

      SET /A ERROR_LOGOUT=900

       

      CD /D %~dp0

      call epmautomate login %user% %password% %url% %domain%

      IF %ERRORLEVEL% NEQ 0 (

      SET /A errorno =%ERROR_LOGIN%

      goto :ERROR)

       

       

       

      call epmautomate uploadfile %dataimportfilename% %importpath%

      IF %ERRORLEVEL% NEQ 0 (

      SET /A errorno =%ERROR_UPLOAD_FILE%

      goto :ERROR)

       

      call epmautomate rundatarule "Rule_1" Oct-17 Oct-17 REPLACE STORE_DATA %importfile%

      IF %ERRORLEVEL% NEQ 0 (

      SET /A errorno =%ERROR_RUN_DATA%

      goto :ERROR)

       

      call epmautomate refreshcube

      IF %ERRORLEVEL% NEQ 0 (

      SET /A errorno =%ERROR_REFRESH_CUBE%

      goto :ERROR)

       

       

       

       

       

       

      :EOF

       

       

      Set objEmail = CreateObject("CDO.Message")

      objEmail.From = "My email"

      objEmail.To = "user email"

      objEmail.Subject = "Task done"

      objEmail.Textbody = "Task done"

      objEmail.Configuration.Fields.Item _

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

      objEmail.Configuration.Fields.Item _

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

      "MySMTPHost"

      objEmail.Configuration.Fields.Item _

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

      objEmail.Configuration.Fields.Update

      objEmail.Send

       

      exit /b %errorlevel%

       

       

       

       

       

      :ERROR

       

      echo Failed with error #%errorlevel%.

       

      exit /b %errorlevel%