Answered Topic Not getting adTempus Variable in VBscript RSS Feed Icon

You must be logged in to reply to this topic.

Avatar
Joined: December 8, 2015
Posts: 8
 

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")

PASO_Server=adTempus.JobVariables("ES_Server")

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?

Thanks,

Guy

 

 
Avatar
Arcana Development Staff
Joined: November 6, 2015
Posts: 305
 

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:


PASO_Server=adTempus.JobVariables("ES_Server")
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
 
Avatar
Joined: December 8, 2015
Posts: 8
 

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.

 

Guy

 
Avatar
Arcana Development Staff
Joined: November 6, 2015
Posts: 305
 

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.

 
Avatar
Joined: December 8, 2015
Posts: 8
 

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....

 
Avatar
Arcana Development Staff
Joined: November 6, 2015
Posts: 305
 

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?

 
Avatar
Joined: December 8, 2015
Posts: 8
 

Hi Bill,

Voila....

Support Case opened.....

 

 
Avatar
Arcana Development Staff
Joined: November 6, 2015
Posts: 305
 

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.

 
You must log in to post.