Javelin - Invoke Process not failing when the .bat file fails

book

Article ID: 198624

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

I am trying to call a .bat file from the Invoke Process component in Javelin. Although the Invoke process functionality is working fine if the bat file executes successfully, the workflow is getting completed even if .bat file fails.

Below is the .bat file content. I am trying to fail the .bat file explicitly giving Exit code as 1 or anything apart from exit code 0 which signifies batch success.
Let me know what can be done to fail the javelin workflow.

Please note I have selected 'ContinueOnError' property of Invoke Process as 'False'.

echo "Start creating CD_ALL.xlsx">>C:\log.txt
cscript C:\MergeAll.vbs
if %errorlevel% NEQ 10 GOTO :error

GOTO :success
:error
echo "There was an error.">>C:\log.txt
echo "Exit the program" >>C:\log.txt
EXIT /B 1


:success
echo "CD_ALL Macro run completed">>>C:\log.txt
EXIT 0



Environment

Javelin 4.9.X
TDM 4.8

Resolution

By default the Invoke Process activity does not take action on exit code.
you can setup a variable to capture the exit code and then take action on that.