Custom Trigger executing only once and workaround

Custom Trigger executing only once and workaround

I’ve installed on my laptop with Windows 10 PRO v1709 build 16299.371 the latest ServiceDeskPlus  v9.4 build 9406, without any parametrization. On this scenario I want to run a script for every request created and for every state change on all requests.

For this trigger, there is a single & simple BAT script copying the received JSON file to another directory (C:\ProgramData\TICKETS) and writting a log entry on C:\ProgramData\LOGS. 


  1. @ECHO OFF
    SETLOCAL ENABLEEXTENSIONS
  2. :: script global variables
    SET me=%~n0
    SET log=%ALLUSERSPROFILE%\LOGS\%me%.txt
    SET src=%~dpfn1
  3. :: The "main" logic of the script
    if exist "%src%" (
     CALL :tee %DATE% %TIME% %me%: ticket processed - %src%
     SET MSG=JSON file copied
     SET RES=success
    ) else (
     CALL :tee %DATE% %TIME% %me%: missing file - %src%
     SET MSG=Missing JSON file
     SET RES=failed
    )
    COPY "%src%" "%ALLUSERSPROFILE%\TICKETS" >>"%log%"
    ECHO {'message':'%MSG%','result':'%RES%'}
  4. :: force execution to quit at the end of the "main" logic
    EXIT /B %ERRORLEVEL%
  5. :: a function to write to a log file
    :tee
    ECHO %* >> "%log%"
    EXIT /B 0


When configured a single Action like this, it doesn’t work as expected







The BAT script executes only once when the status is created, but it never executes again if the status is changed to OnHold, Resolved or Closed.  In order to have it working properly, I’ve configured five different actions calling the same script each time.


The question is: WHY???


                  New to ADSelfService Plus?