Not getting adTempus Variable in VBscript

GuyS (45 posts)
November 8, 2016 05:41 AM
Accepted Answer

Hello World :-),

I try to use a VARIABLE, set in a adTempus Variable tab:

     Variable ES_Server, value PASO17P1

in a script like:

adtempus.LogMessage 1, 0, "User script starting"

Dim filesys

Set filesys = CreateObject("Scripting.FileSystemObject")


rem ES_Server="GS2016"

If filesys.FileExists("F:\MFES\ESServers\" & PASO_Server & "\Data\TRIGGERS\adTempusChk.txt") Then filesys.DeleteFile "F:\MFES\ESServers\" & PASO_Server & "\Data\TRIGGERS\adTempusChk.txt"

End If

Result=">" & PASO_Server

When I press the Test button it ends OK with

     Script completed with result ">"

No value for PASO_Server.

We are running with Product Version: 4.2 Hotfix 15243.1514

Can anyone help me?




This topic has an accepted answer. Jump to it.
Bill Staff (602 posts)
November 9, 2016 07:13 AM
Accepted Answer

I confirmed that the Result variable is behaving as you described, and I don't know why that is. I'll look into it further.

However, in my tests the variable is getting retrieved properly. You can confirm this by adding a log statement:

adtempus.LogMessage 1, 0, "value: " & PASO_Server

Note that for a Script task, adTempus is expecting your Result to be a numeric value that indicates success or failure (see the Options page of the step properties). Setting it to anything other than a numeric value won't do anything for you.

You also might want to consider moving from VBScript to VB.NET where feasible for new scripts. The equivalent script using VB.NET would be:

Imports System
Imports System.Collections.Generic
Imports ArcanaDevelopment.adTempus.Shared
Imports ArcanaDevelopment.adTempus.ApplicationIntegration
Imports System.IO

Public Class UserScript
    Inherits ArcanaDevelopment.adTempus.ApplicationIntegration.UserScriptBase

    Public Overrides Function Run() As Object

		Dim serverName=adTempus.JobVariables("ES_Server") 
        adtempus.LogMessage(MessageTypeEnum.Informational, 0, "Server: " & serverName)
		If File.Exists("F:\MFES\ESServers\" & serverName & "\Data\TRIGGERS\adTempusChk.txt") Then 
			File.Delete("F:\MFES\ESServers\" & serverName & "\Data\TRIGGERS\adTempusChk.txt")
		End If
        Return 0
    End Function
End Class
GuyS (45 posts)
November 9, 2016 09:58 AM
Accepted Answer

Hi Bill,

Thanks for your reply.

I added the logMessage and tried your VB.NET example, both with no value as a result.

I tried it on our Test- and Production server as well. Same result.



Bill Staff (602 posts)
November 9, 2016 11:05 AM
Accepted Answer

I double-checked this on a server running 4.2 and it's still working correctly for me. Make sure you have the variable name correct.

After you run the job, look in the Captured Files for the instance and open the Job Detail Log. Go down to "Job Variable values at step end" and make sure the variable is there.

GuyS (45 posts)
November 10, 2016 12:48 AM
Accepted Answer

Checked and double checked.

Maybe it's the Product Version: 4.2 Hotfix 15243.1514?

The Hotfix was specially for us and related to variables....

Bill Staff (602 posts)
November 10, 2016 06:02 AM
Accepted Answer

I tested with that build as well. Please open a support case and send an export of the job so I can see if I've got things set up differently than you.

Is the variable showing correctly in the Job Detail Log?

GuyS (45 posts)
November 10, 2016 09:23 AM
Accepted Answer

Hi Bill,


Support Case opened.....


Bill Staff (602 posts)
November 11, 2016 07:28 AM
Accepted Answer

The script was being run from a Script Action in a Response, not as a Task as I had it set up. In that scenario (as an Action), the variable is not present when you test the script in the Script Editor so it shows the wrong information. When you actually run the job, the variable is present and the script works as expected.

I will write it up as a bug to get fixed--the variable should be available when you test the script.

Replies are disabled for this topic.